Apache2 Configuration Error: “No MPM Loaded” – Diagnosis and Solutions for Ubuntu/Vagrant Environments


2 views

When working with Apache2 on Ubuntu Precise64 in a Vagrant environment, encountering the "No MPM loaded" error can be confusing - especially when your configuration files don't explicitly reference any MPM module. Let's break down what's happening under the hood.

The error message indicates Apache can't find a Multi-Processing Module (MPM) to handle incoming connections. Even if your config file doesn't mention MPM, Apache requires one to function properly. The modules shown in your apache2 -l output confirm no MPM is currently loaded.

First, let's see what MPM modules are available on your system:

ls /etc/apache2/mods-available/mpm_*

Common Ubuntu MPM modules include:

  • mpm_prefork (traditional)
  • mpm_worker (hybrid)
  • mpm_event (latest)

For most Vagrant/Ubuntu setups, mpm_prefork is the safest choice:

sudo a2dismod mpm_event  # if previously enabled
sudo a2enmod mpm_prefork
sudo service apache2 restart

After enabling an MPM, verify it's active by checking:

apache2ctl -M | grep mpm

You should see output like:

mpm_prefork_module (shared)

While your main config may not reference MPM, Ubuntu's modular setup includes MPM configurations in:

/etc/apache2/mods-available/mpm_prefork.conf

Sample content:

<IfModule mpm_prefork_module>
    StartServers            5
    MinSpareServers         5
    MaxSpareServers        10
    MaxRequestWorkers      150
    MaxConnectionsPerChild   0
</IfModule>

For Vagrant environments, consider lowering these values to conserve resources:

<IfModule mpm_prefork_module>
    StartServers            2
    MinSpareServers         2
    MaxSpareServers         5
    MaxRequestWorkers       50
</IfModule>

For better performance in development environments:

sudo a2dismod mpm_prefork
sudo a2enmod mpm_worker
sudo service apache2 restart

Then adjust worker settings in:

/etc/apache2/mods-available/mpm_worker.conf

To locate error logs for deeper troubleshooting:

grep ErrorLog /etc/apache2/apache2.conf
# Or check default location:
ls /var/log/apache2/error.log

For a full system check:

apache2ctl -S
apache2ctl -M
apache2ctl -t

When starting Apache2 on Ubuntu, seeing "No MPM loaded" can be confusing - especially when you haven't explicitly configured any MPM module. This error occurs because Apache requires a Multi-Processing Module (MPM) to function, even if you haven't specified one in your configuration.

Apache is built with a default MPM (usually prefork on Ubuntu), but sometimes the package installation might miss enabling it. The apache2 -l output confirms this - no MPM appears in the compiled modules list.

$ apache2ctl -l | grep mpm
(no output means no MPM loaded)

First, verify which MPMs are actually available in your installation:

$ ls /etc/apache2/mods-available/ | grep mpm
mpm_event.load
mpm_prefork.load
mpm_worker.load

Enable one of the available MPMs. For most standard setups, prefork is the safest choice:

$ sudo a2enmod mpm_prefork
$ sudo service apache2 restart

For better performance with PHP-FPM, you might prefer the worker MPM:

$ sudo a2dismod mpm_prefork
$ sudo a2enmod mpm_worker
$ sudo service apache2 restart

After enabling an MPM, verify it's active:

$ apache2ctl -M | grep mpm
mpm_prefork_module (shared)

In rare cases, you might need to reinstall Apache with MPM support:

$ sudo apt-get purge apache2
$ sudo apt-get install apache2-mpm-prefork apache2

Once working, you might want to tune your MPM settings. For prefork, add to your config:


    StartServers            5
    MinSpareServers         5
    MaxSpareServers         10
    MaxRequestWorkers       150
    MaxConnectionsPerChild  0