How to Activate Worker MPM on Apache2 in Ubuntu
The Apache2 worker Multi-Processing Module, or MPM, implements Apache HTTPD by using a threaded model. The worker MPM is significantly faster than traditional models and is recommended by Apache for high-traffic servers. Unlike the prefork MPM, the worker MPM has a small memory footprint and overhead. Activating the worker MPM in Apache2 on Ubuntu is easier than it sounds: You just need to download, install and configure it by using the Ubuntu command line interface.
Instructions
-
-
1
Go to "/etc/php5/cgi/" and create a backup of your "php.ini" file. The worker MPM installation will overwrite this file.
-
2
Open the Ubuntu command line interface and type this command to install the Apache2 worker MPM: "sudo apt-get install apache2-mpm-worker php5-cgi." Note that during the installation, the "apache2-mpm-prefork" and "libapache2-mod-php5" are removed.
-
-
3
Run these commands in your Ubuntu command line interface to enable the "cgi" and "cgid" modules necessary for the worker MPM to function: "a2enmod cgi" and "a2enmod cgid."
-
4
Run these commands in your Ubuntu command line interface to activate the "mod_actions" Apache2 modules: "cd /etc/apache2/mods-enabled," "sudo ln -sf ../mods-available/actions.load" and "sudo ln -sf ../mods-available/actions.conf."
-
5
Open the "actions.conf" configuration file by using this command: "sudo vi /etc/apache2/mods-available/actions.conf." Add this to the configuration file: "<IfModule mod_actions.c>
Action application/x-httpd-php /cgi-bin/php5</IfModule>." -
6
Open the "apache2.conf" configuration file by using this command:
sudo vi /etc/apache2/apache2.conf
You can change your configuration by editing the following lines:
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0 -
7
Run this command in your Ubuntu command line interface to check the installation:
/usr/sbin/apache2ctl -t
If you receive a "Syntax OK" message, your worker MPM works properly.
-
8
Restart Apache2 to apply the settings by using this command:
sudo /etc/init.d/apache2 restart
-
1
References
Resources
- Photo Credit Comstock/Comstock/Getty Images