|
|
<VirtualHost *:80>
5 y' d$ H: ]# @ RewriteEngine on
0 R4 T7 y+ d0 {$ } RewriteCond %{SERVER_PORT} !^443$, ^1 `' w L: M9 Q) L: L: W g W" C7 Y
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
v9 {3 T: h6 `# t# Y</VirtualHost>
1 f0 X2 Y+ u8 A8 l( f! l5 x5 g$ F
1 \( d# D* l$ ^' G$ x* u
& F) G2 ^6 F) p" n8 @& a) a2 H/ ?3 D: d
添加https服务:
. W5 |, s2 H1 C" s1 ?1 C; r- H- M" r重启httpd服务,报错:: `! X/ f7 g4 u7 }, c/ m
2 V/ [3 E7 W7 ]2 r5 L# \
2 \0 o, `9 P; i( g+ c! OInvalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
& U. a/ S. n! \$ U
" c4 V, `( \7 i% m; Y% t- o* e: {, y/usr/local/httpd/bin/apachectl restart
6 v$ Y, Y# f1 r- ZAH00526: Syntax error on line 248 of /usr/local/httpd/conf/httpd.conf:
$ C" L+ x% n0 u. L* ^( }. eInvalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration5 M8 I" `6 F, x# V6 O6 I, _! ?
0 n3 @0 W9 \% s) p
. d' p3 _1 j, A0 j% J解决办法:
3 h- A" k; k8 |- |6 B9 C4 ~* g
! E. D6 @0 w2 S# I修改httpd.conf 8 V9 R1 D# k" C2 u. v- `4 O+ z& u
#LoadModule rewrite_module modules/mod_rewrite.so & G/ i: Y: o2 f% E/ c
# a- I' ~, ?4 J7 V# Y/ b, j* h3 m+ Z1 HLoadModule rewrite_module modules/mod_rewrite.so9 i, M! T1 s% ?5 C' V$ m$ y
5 ^2 v- M7 G a' A7 f9 l0 E' u$ c; L9 ^4 M2 K3 p
4 ?% Y+ Z' T) i* n /usr/local/httpd/bin/apachectl restart5 O6 `9 Y+ K7 O- ^
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:feaa:acc1%ens160. Set the 'ServerName' directive globally to suppress this message
$ L) Q% i1 y8 c- U# S& i
: G* k# |: K, H( w1 y& y7 H0 U% i
+ H6 v0 @- c' G5 h" a( B1 u( p
) m0 u! h' f$ k% \) t
' p6 J8 ]! {) U/ J& | |
|