LAMP on Ubuntu 14.04 with Apache Event MPM


I came across some really excellent tutorials on DigitalOcean on how to install LAMP on Ubuntu, but none of them mention anything about choosing a specific Apache MPM (Multi Processing Module).

The latest versions of Apache offer the Event MPM, which is the Apache’s only hope and fighting chance for good benchmarks against NGINX. The Ubuntu 14.04 LAMP image is configured with the oldest Prefork MPM, which is also the clumsiest and RAM hungriest of all Apache MPMs.

It would be great to see a tutorial on how to configure Apache in a LAMP setup to use the Event MPM with - or without - PHP-FPM.

Much appreciated!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Assuming that you’re starting with a basic LAMP stack, to get Event MPM and PHP-FPM up and running on Ubuntu 14.04 first install these packages:

sudo apt-get install libapache2-mod-fastcgi php5-fpm apache2-mpm-event

Then create the file /etc/apache2/conf-available/php5-fpm.conf with the contents:

<IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

    <Directory /usr/lib/cgi-bin>
        Require all granted


Then enable the new mods and config:

sudo a2enmod actions fastcgi alias
sudo a2dismod mpm_prefork php5
sudo a2enconf php5-fpm
sudo a2enmod mpm_event
sudo service apache2 restart

You should be all set to go!

This was asked a while ago, but for anyone still interested, check out this awesome article …not written by me sadly :)