Switching Apache to the event multi-processing module (MPM) improves concurrency and responsiveness on busy hosts, especially with long-lived KeepAlive connections and HTTP/2 traffic. The event MPM prevents idle keep-alive connections from consuming worker capacity, which can lower latency and reduce wasted memory under load.
An MPM is the core Apache module that decides how connections map onto processes and threads. On Ubuntu and Debian, the active MPM is controlled by enabling exactly one of mpm_event, mpm_worker, or mpm_prefork via symlinks in /etc/apache2/mods-enabled, typically managed with a2enmod and a2dismod.
Only one MPM can be loaded at a time, and changing it requires restarting the apache2 service. The event (and worker) MPM is threaded, so modules that require a non-threaded model—most notably embedded mod_php from libapache2-mod-php—must be removed or replaced with a process-based runtime such as PHP-FPM; otherwise the server may refuse to start or revert to prefork behavior.
Related: How to enable or disable Apache modules
Related: How to test your Apache configuration
Steps to enable the event MPM in Apache:
- Open a terminal with sudo privileges.
$ whoami user
- Confirm which Apache MPM is currently active.
$ apache2ctl -V | grep -i mpm Server MPM: prefork
- Check for an embedded PHP module before switching to a threaded MPM.
$ apache2ctl -M | grep -E 'php[0-9]+_module|php_module' php_module (shared)
No output indicates mod_php is not loaded.
A matching php*_module line typically indicates libapache2-mod-php is active and requires mpm_prefork; enable mpm_event only after moving PHP to PHP-FPM (or equivalent) to avoid startup failures.
- Disable the embedded PHP module if it is loaded (example shown for PHP 8.3).
$ sudo a2dismod php8.3 Module php8.3 disabled. To activate the new configuration, you need to run: systemctl restart apache2
Replace php8.3 with the installed libapache2-mod-php module name on your host.
- Disable the prefork MPM module.
$ sudo a2dismod mpm_prefork Module mpm_prefork disabled. To activate the new configuration, you need to run: systemctl restart apache2
- Disable the worker MPM module if it is enabled.
$ sudo a2dismod mpm_worker Module mpm_worker already disabled
- Enable the event MPM module.
$ sudo a2enmod mpm_event Considering conflict mpm_worker for mpm_event: Considering conflict mpm_prefork for mpm_event: Enabling module mpm_event. To activate the new configuration, you need to run: systemctl restart apache2
- Test the Apache configuration for syntax errors.
$ sudo apache2ctl -t Syntax OK
- Restart the apache2 service to apply the MPM change.
$ sudo systemctl restart apache2
On RHEL-family systems, the service name is typically httpd rather than apache2.
- Verify that Apache now reports the event MPM.
$ apache2ctl -V | grep -i mpm Server MPM: event
- Confirm the service is running after the change.
$ sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled) Active: active (running) since Sat 2026-01-10 13:10:29 +08; 326ms ago Docs: https://httpd.apache.org/docs/2.4/ ##### snipped #####
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
