Docker Wordpress 返回 500 服务器错误

问题描述 投票:0回答:1

当我开始在浏览器中收到此错误时,我正在使用 wordpress docker 容器进行开发:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.57 (Debian) Server at localhost Port 8080

我的终端出现这个错误:

wordpress-1  | [Wed Feb 21 19:18:21.258309 2024] [core:alert] [pid 38] [client 192.168.65.1:37509] /var/www/html/.htaccess: </IfModule> without matching <IfModule> section
wordpress-1  | 192.168.65.1 - - [21/Feb/2024:19:18:21 +0000] "GET / HTTP/1.1" 500 801 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"

我尝试重新启动容器,但没有成功。然后我完全停止容器,然后再次启动它。那也没用。我开始做一些研究,发现这是 apache2 服务器问题。为什么会出现这种情况?

wordpress docker docker-compose apache2
1个回答
0
投票

对于可能遇到此问题的任何人,这就是解决方法:

错误发生在您的

.htaccess
文件中。

这是错误消息

 </IfModule> without matching <IfModule>

登录 WordPress 容器并打开

.htaccess
文件。然后添加一个开始
<IfModule mod_rewrite.c>
以匹配缺少开始标签的结束
</IfModule>
标签。或者,如果不需要,请删除整个块(您可能不想在生产中执行此操作)。

© www.soinside.com 2019 - 2024. All rights reserved.