Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

apache - docker/httpd: Configuration error: No MPM loaded

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.

Nothing else.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

(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.


After digging the commits of the official httpd image, I found the solution. (maybe this question/answer may help others)

For those who stumble onto this note while looking for a solution, just add LoadModule mpm_event_module modules/mod_mpm_event.so into httpd.conf above the other LoadModule directives.

(from the comments on the commit #17166574)

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.

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

or, for a more future-proof solution, you could modify the original http.conf file using sed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...