I’ve decided that I need to up my game when it comes to webservers. However I’m not yet ready to switch to Nginx or one of the other webservers out in the wild as I need something up and running rapidly.
Granted the numbers are definitely against Apache in a lot of benchmarks but historically I’ve always had a good experience and the entry level makes it much more appropriate for me to stick with it.
However Apache 2.2 is rather long in the tooth, thankfully 2.4 has been out for a while now. The problem I have is that I tend to favour Ubuntu as a platform and there is no sign of a 2.4 version appearing on the horizon anytime soon as they are waiting for it to be implemented upsteam in Debian before including it in Ubuntu.
Now there are PPAs available out there but im not overly happy using them (especially on production environments) So the only option is to compile.
First thing is to install all the dependencies we are going to need. Thankfuly ubuntu has a nice and simple way of handling this.
apt-get build-dep apache2
We can then download the source code and start the compilation.
So from the root of our new copy of the source we need to run our configure.
./configure --prefix=/usr/local/apache2 \
You will notice that I’m installing it using the event mpm. Hopefully I’ll be covering more about the event mpm in the future.
Next we need to run make
make && make install
Once that’s complete you should be able to run
and get the “it works” message through your webrowser when accessing the server IP.
Dont forget to configure apache to suit your specific requirements.
So in the file
/etc/ini/apache.conf we need to put
# apache2 - http server
# Apache is a web server that responds to HTTP and HTTPS requests.
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
author "Matt Cockayne <[email protected]"
description "Apache 2.4 HTTP Server"
start on runlevel 
stop on runlevel [!2345]
mkdir -p /var/run/apache2 || true
install -d -o www-data /var/lock/apache2 || true
# ssl_scache shouldn't be here if we're just starting up.
# (this is bad if there are several apache2 instances running)
rm -f /var/run/apache2/*ssl_scache* || true
# Give up if restart occurs 10 times in 30 seconds.
respawn limit 10 30
if test -f /usr/local/apache2/bin/envvars; then
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
/usr/local/apache2/bin/httpd -k start -D FOREGROUND
This is a rather simple upstart script and I will be looking to update it at some point… but it works
Once that’s done you should find that on reboot Apache will start and take advantage of all the management features of upstart including attempting to respawn Apache should it end unexpectedly. You should also be able to then use the following commands to control Apache.
I generally tend to avoid using the apachectl script found at /usr/local/apache/bin/apachectl once upstart takes control.