docker/httpd:配置错误:未加载 MPM [英] docker/httpd: Configuration error: No MPM loaded
问题描述
我有一个基于 httpd 官方镜像的 docker 容器.从无到有(在新构建之后),它开始失败并出现错误:
I have a docker container based in the httpd official image. From nowhere (after a new build), it started failing with the error:
AH00534: httpd: Configuration error: No MPM loaded.
没有别的.
我使用的是官方 httpd 映像(FROM httpd:2.4
),到目前为止一切正常.
该错误仅在使用 docker system prune -af
I'm using the official httpd image (FROM httpd:2.4
) and everything was working fine until now.
The error appeared only after pruning all images in my system with a docker system prune -af
推荐答案
(编辑,感谢 delboy1978uk)如果应用简单的最佳实践,则可以避免该错误:将您的 docker 图像固定到特定版本而不是 latest
.
(edit, thanks delboy1978uk)
The error could be avoided if applied a simple best practice: pin your docker images to a specific version instead of latest
.
在挖掘了官方httpd镜像的提交后,我找到了解决方案.(也许这个问题/答案可能对其他人有帮助)
After digging the commits of the official httpd image, I found the solution. (maybe this question/answer may help others)
对于那些在寻找解决方案时偶然发现此说明的人,只需将 LoadModule mpm_event_module modules/mod_mpm_event.so
添加到httpd.conf
位于其他 LoadModule 指令之上.
For those who stumble onto this note while looking for a solution, just add
LoadModule mpm_event_module modules/mod_mpm_event.so
intohttpd.conf
above the other LoadModule directives.
所以,因为我在没有明确声明 MPM 模块的情况下覆盖了文件 /usr/local/apache2/conf/httpd.conf
,在这次提交之后,我的图像开始失败.
有了这个快速修复,现在一切都很好.
So, because I was overriding the file /usr/local/apache2/conf/httpd.conf
without explicitly declare an MPM module, after this commit, my image started to fail.
With this quick fix, everything is fine now.
为了完全更正,请将其添加到您的 httpd.conf
文件中(感谢 svinther):
For the complete correction, add this to your httpd.conf
file (thanks svinther):
LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
或者,为了获得更面向未来的解决方案,您可以使用 sed 修改原始的 http.conf 文件.
or, for a more future-proof solution, you could modify the original http.conf file using sed.
这篇关于docker/httpd:配置错误:未加载 MPM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!