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

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-1-3 10:00:00 | 显示全部楼层 |阅读模式
<VirtualHost *:80>! U( L; G2 o4 k. }
RewriteEngine on/ Y( k5 `6 Y4 Q  A
RewriteCond %{SERVER_PORT} !^443$/ F& n0 x+ w; `% P8 m" l
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]5 z/ I% W" n5 ~6 G9 Y5 H: D6 ?, |7 z
</VirtualHost>) c; j$ N' J3 B4 D8 B& ]

+ w* `" n: C9 o: z4 r6 }
' Z+ G6 S4 R4 f3 P& k( q5 T4 D. X+ u0 e& L" d7 h5 s  B: y7 p
添加https服务:7 E0 e& g$ p! }8 A& E
重启httpd服务,报错:( ^6 z- `9 G, c8 _

/ Q( h6 J" j6 |! J0 v
. a0 `5 |* {5 d7 k3 Y4 XInvalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration- K( b" n! @, f/ m2 p- P# _
! }! F3 R# M7 I9 ~# J7 ^; D7 A
/usr/local/httpd/bin/apachectl restart, Q3 F  _0 |. Y9 J; p* [' Q
AH00526: Syntax error on line 248 of /usr/local/httpd/conf/httpd.conf:
, q+ M+ e! O& o- x) ?Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
, e8 q$ \+ ?3 G7 q2 p2 ?* N8 K/ W4 Y' s% s/ ^

" `/ s0 E4 b( r& t- Y$ O* k解决办法:& x1 q; [' j9 B' c* b) Y
4 F1 T) M; S2 }# F" p+ ?
修改httpd.conf $ k" o7 X7 d0 ?+ h
#LoadModule rewrite_module modules/mod_rewrite.so     S  e1 q$ _  A9 D! t3 V) i  w

$ }" Y7 t9 I( A. m/ m. ^8 GLoadModule rewrite_module modules/mod_rewrite.so
7 A6 X% M3 c# X. k) G+ l) ~. A5 [+ k
$ e  y; Q6 A8 q% ?
7 d- {: u& u1 v9 H
/usr/local/httpd/bin/apachectl restart4 V) R+ k# l; W' j* a
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 message4 X- b0 ]) \2 T! R7 E

- [+ `" [5 G5 w1 `/ h
7 A& |9 E% `& }" Q' |. @. {/ c4 t# m
4 J; O- ?8 R. ?0 @5 `
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:45 , Processed in 0.015266 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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