找回密码
 注册
查看: 4|回复: 0

httpd 服务启动时报错:Invalid command 'RewriteEngine', perhaps misspelled or defined by

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-1-3 10:00:00 | 显示全部楼层 |阅读模式
<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& |
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:48 , Processed in 0.013025 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表