RHEL (CentOS) – changing Apache’s MPMs

Well, in EL6 when we wanted to change Apache’s MPMs we would edit /etc/sysconfig/httpd and set the HTTPD variable with the binary needed.It looks something like:


To see the available options we could type the following command:

[root@server ~]# ls  /usr/sbin/httpd*
/usr/sbin/httpd  /usr/sbin/httpd.event  /usr/sbin/httpd.worker

The simple httpd binary uses the Prefork MPM, httpd.worker is the Worker MPM or httpd.event is Event MPM. After changing the variable we would need to restart httpd.

In EL7 (CentOS7/RHEL 7/etc.), that uses Apache 2.4 things have slightly changed. MPMs can now be compiled as DSO modules and to change the wanted MPM we need to edit the file called /etc/httpd/conf.modules.d/00-mpm.conf File contains something like:

# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines:

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
#LoadModule mpm_worker_module modules/mod_mpm_worker.so

# event MPM: A variant of the worker MPM with the goal of consuming
# threads only for connections with active processing
# See: http://httpd.apache.org/docs/2.4/mod/event.html
#LoadModule mpm_event_module modules/mod_mpm_event.so

Here we need to uncomment/comment lines, then restart the httpd service (systemctl restart httpd).