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

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

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

After comparing my configuration with latest httpd:2.4 configuration, I found that these new lines needed to be merged into conf/httpd.conf
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
Note to self: When building the derivative httpd docker image, it would probably be better to mod the conf files with sed, than to just COPY in a static file

If you are using Docker for Windows, you might be running into a File conversion issue. Be sure to check the encoding of your httpd.conf, it should be Unix LF - UTF8.

Much as the accepted solution works, it is less than ideal. The real reason you are getting this error is most likely the fact that your Dockerfile begins with the following line:
FROM httpd:latest
That latest part, is you asking for the latest and greatest version of Apache.
Don't do that. This is your infrastructure. Lock it down to a version number.
Something like
FROM apache:2.4.0
This is the real answer. Not doing that risks your own codebase failing when third party software vendors update their code.
Get the latest version of httpd.conf, and take a note of the version number, then tweak it with your changes, and get that :latest the hell out of your Dockerfile.

I´m using this in my docker file
FROM php:7.2-apache
And i fixed this problem adding this line to /etc/docker/daemon.json
{
"storage-driver": "devicemapper"
}

Related

AH00534: apache2: Configuration error: No MPM loaded [duplicate]

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
(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.
After comparing my configuration with latest httpd:2.4 configuration, I found that these new lines needed to be merged into conf/httpd.conf
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
Note to self: When building the derivative httpd docker image, it would probably be better to mod the conf files with sed, than to just COPY in a static file
If you are using Docker for Windows, you might be running into a File conversion issue. Be sure to check the encoding of your httpd.conf, it should be Unix LF - UTF8.
Much as the accepted solution works, it is less than ideal. The real reason you are getting this error is most likely the fact that your Dockerfile begins with the following line:
FROM httpd:latest
That latest part, is you asking for the latest and greatest version of Apache.
Don't do that. This is your infrastructure. Lock it down to a version number.
Something like
FROM apache:2.4.0
This is the real answer. Not doing that risks your own codebase failing when third party software vendors update their code.
Get the latest version of httpd.conf, and take a note of the version number, then tweak it with your changes, and get that :latest the hell out of your Dockerfile.
I´m using this in my docker file
FROM php:7.2-apache
And i fixed this problem adding this line to /etc/docker/daemon.json
{
"storage-driver": "devicemapper"
}

Could not open the requested SVN filesystem on windows7

while configuring apache httpd with subversion on windows 7, getting below error..
i had already installed with different types of versions of SVN and apache also still im facing this issue.. could please some one help me out of this issue..
svn, version 1.9.1 (r1698128) `compiled Sep 1 2015, 19:50:43 on x86-microsoft-windows`
httpd-2.2.22-win32-x86-openssl-0.9.8t,
Server version: Apache/2.2.22 (Win32)
Server built: Jan 28 2012 11:16:39
and previously i had installed svn for 1.8.18 and httpd-2.2.25-win32-x86-openssl-0.9.8y
i copied these below files to apache/conf/httpd
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
Getting below Error:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<D:error xmlns:D="DAV:" xmlns:m="http://apache.org/dav/xmlns" xmlns:C="svn:">
<C:error/> <m:human-readable errcode="160043">Could not open the requested SVN filesystem</m:human-readable>
</D:error>
At first, show your full httpd.conf file and see what's logged to Apache log. I guess that you'll understand the root cause by looking through the log.
Next, if you have troubles setting up SVN+Apache server on Windows yourself, search the web for prepackaged all-in-one solutions. E.g. google "svn server windows". Otherwise, check the official binary packages page.
Update:
The most interesting part of the logged error is:
E160043: Expected FS format between '1' and '6'; found format '7'
The error means that you have Subversion 1.8 installed as your server. However, the repository was created using Subversion 1.9 tools and has newer format. You should make sure that your server is on the most current version 1.9 or create the repository using 1.8 tools. There is another option that may help you: create the repository using svnadmin create REPOSITORY --compatible-version 1.8 command.
The fact that when you run svn --version you see version 1.9.1 (r1698128) just means that your command-line client has version 1.9.1. This is irrelevant to the server side.

How to add H264 streaming module to Apache?

I want to add the H264 streaming module to Apache. I'm on Windows using the stack WAMPserver 2.2 with Apache 2.2.22, and I have put the module (mod_h264_streaming.so) in the module directory. I've added the LoadModule code into httpd.conf but, alas, the server doesn't work (the icon shows orange). This is what I entered in httpd.conf
LoadModule h264_streaming_module modules/mod_h264_streaming.so
I have no idea what or where the problem is, and it's causing many headaches. This particular module is essential to my project. I realize this is probably vague troubleshooting, but I would greatly appreciate any advice.
Thanks in advance.
Step by Step
1- At first Download Visual Studio 2008 x64 SP1, be sure to install the Visual C++ 2008 x64 SP1 Redistributable Package
it can be downloaded from;
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=BA9257CA-337F-4B40-8C14-157CFDFFEE4E (Setup this)
2- Download Apache module mod_h264_streaming from ; https://www.apachehaus.net/modules/mod_h264_streaming/ in the below.Before download Please careful about your apache version.consider it.
3- Extrach files , copy "mod_h264_streaming.so"
3- If you are using Wamp server go the C:\wamp\bin\apache\Apache2.4.4\modules and drop(add,copy what ever you say) mod_h264_streaming file to the path. If you are not using wamp go to C:/Apache24/modules/ and add mod_h264_streaming.
4- Then Go to httpd.conf (in the C:\wamp\bin\apache\Apache2.4.4\conf path) , open with notepad++ find load modules line
just like ;
LoadModule auth_basic_module modules/mod_auth_basic.so // opened module
#LoadModule auth_digest_module modules/mod_auth_digest.so // closed module
#LoadModule authn_anon_module modules/mod_authn_anon.so
When you find the lines add this ;
LoadModule h264_streaming_module modules/mod_h264_streaming.so
save and quit. Finally restart the apache server. Module is ready to serve you.

Subversion failed on Centos

My apache server failed once I rebooted my centos server. When I try to start the service I get this error:
httpd: Syntax error on line 35 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/mod_dav_svn.so into server: /usr/local/apache/modules/mod_dav_svn.so: undefined symbol: dav_register_provider
Reading some articles I found that I need to load mod_dav.so before mod_dav_svn.so but I don't have this file in my server.
Reinstalling subversion don't worked too.
Any idea ??? thank you !
Are you saying that you don't have mod_dav.so? Do you have the line
LoadModule dav_module modules/mod_dav.so
in your httpd.conf? Perhaps you can post the relevant parts of your conf file.
In regards to why you're seeing it once you rebooted, perhaps you made some changes and hadn't yet restarted the apache service, meaning that it's just not showing you the problems.

how to get trac to run with apache?

i have some problems getting trac to be running with apache.
have no idea of how to do and the tutorial i followed doesnt work.
http://trac.edgewall.org/wiki/TracModPython
i have an empty /etc/apache2/httpd.conf. should it be empty?
then i followed the tutorial and typed in:
LoadModule python_module modules/mod_python.so
so now it contains one row. i have ubuntu and i installed mod_python with:
apt-get install libapache2-mod-python libapache2-mod-python-doc
however, when i run a2enmod mod_python it says:
ERROR: Module mod_python does not exist!
but i have checked that it exists in /usr/lib/apache2/modules/mod_python.so.
so whats the problem?
Usually, installing mod_python via:
apt-get install libapache2-mod-python
will enable it. If it does not, the correct command is:
a2enmod python
note, the module is 'python', not 'mod_python'.
First, your httpd.conf may be empty, but you should also have a apache2.conf in the same directory that actually contains all the server directives.
As for the module, I was having the same issue and then did some digging. If you look in /etc/apache2/mods-enabled, you should have one in there called "python.load" (I do at least). If you open that up with vi, you will notice the following line in that file:
LoadModule python_module /usr/lib/apache2/modules/mod_python.so
I think that it may just be that its installed with a different name. If someone else knows different, I would be interested in hearing their views as well.
Regards,
Jeff