Fix Apache 2.4 Loading Wrong MPM Module Event PreforkHere’s a solution that some Ubuntu server operators may not even know they need.

I have noticed for some time that each time there is an Apache 2.4 security update applied, Apache decides to default it’s MPM process back to the Prefork module (mpm_prefork) instead of as the way I had it set in my enabled modules to actually be the Event module (mpm_event) which is a threaded module and much faster.

The only way I ever picked up on this would be that now and again I would notice some sluggishness in Apache and when I went and looked in the loaded modules it had reverted back to using the Prefork (mpm_prefork) all by itself. Unless you have a busy server you may not even notice the difference until one day Apache hangs or crashes which I have never had happen with the Event module.

To fix this in the past I would simply disable the prefork mpm module, enable the event mpm module and restart apache but after a year of this happening I decided today to just fix it for good and here’s how.

On Ubuntu open the following two files in nano or your favorite text editor as below.

sudo nano /etc/apache2/mods-available/mpm_prefork.load

Comment out the line below by adding the # in front of it

#LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so

and then also with

sudo nano /etc/apache2/mods-available/mpm_worker.load

Comment out the line below by adding the # in front of it

##LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so

It’s as simple as that, now Apache cannot just decide to switch to the prefork or worker module after an update even if it should want as they are now disabled from loading completely.

On Debian it’s as easy as

Look in:

/etc/httpd/conf.modules.d

You’ll find a file called:

00-mpm.conf

You can make sure only the MPM module you want to load is commented out, the rest must stay commented:

#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
LoadModule mpm_event_module modules/mod_mpm_event.so

 

Happy Nixing Everyone !!!

2 thoughts on “Fix Apache 2.4 Loading Wrong MPM Module Event Prefork

  1. Pingback: Google PageSpeed Apache and Ubuntu - Chasing Ghosts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.