Upgrading Apache HTTP Server 2.2 to 2.4 on Ubuntu 12.04

By | July 17, 2014

In this post I want to describe the steps I had to go through when updating an Apache HTTP Server 2.2 instance running on Ubuntu 12.04 to version 2.4 without building the Apache HTTP Server from source.
The reason for upgrading Apache HTTP Server was that version 2.2 lacks support for elliptic curve ciphers.

a_plus_a_is_true

Disclaimer: Use these instructions at your own risk! The procedure described worked for me but I cannot guarantee that it will work for you.

Since I am new to the Apache HTTP Server, I wanted to avoid building it from source assuming that it would further complicate things. Fortunately I found a PPA containing version 2.4.9 of the Apache HTTP Server for Ubuntu 12.04. The PPA can be found at https://launchpad.net/~ondrej/+archive/ubuntu/php5 [link broken]

To determine which version of the Apache HTTP Server is installed on your computer, use the following command:

Before performing the actual upgrade/install I recommend making a backup copy of the entire Apache HTTP Server configuration directory that is located at /etc/apache2, since it will be deleted in the process.
The steps described below assume that you are logged in as root on the computer on which you want to upgrade/install the Apache HTTP Server.

Let’s get started!

  • Make a backup copy of the Apache HTTP Server configuration directory that is located at /etc/apache2.
  • Make note of the enabled mods in the current version of your Apache HTTP Server instance:
  • Stop any existing instance of the Apache HTTP Server:
  • Delete the directory containing the Apache HTTP Server configuration (you did make a backup, right?):
  • Remove the existing installation of the Apache HTTP Server:
  • Add the PPA containing version 2.4 of Apache HTTP Server for Ubuntu 12.04:

    In the case that you later want to remove the PPA for some reason, use the commands “add-apt-repository –remove ppa:ondrej/php5” and “apt-get update”.
  • Install Apache HTTP Server 2.4:
  • Update any configuration files to the format used by Apache HTTP Server 2.4.
    In my case, this involved the file “ports.conf” and some site configuration files (originally located in /etc/apache2/sites-available).
  • Enable any custom site configurations:
    If you have a site configuration file named “mysite.conf” in the “sites-available” directory, you would issue the following commands:
  • Enable the mods you need.
    It seems like Apache HTTP Server 2.4 has a smaller number of mods enabled as per default, so I had to enable a number of mods I needed.

    Compare the mods in this directory with the list of mods enabled in your old instance of Apache HTTP Server that was created earlier and written to the file ~/enabled-mods.txt.
    For instance, if you need to enable the ssl mod, issue the following commands:

    In addition to the mods I had earlier, I also had to enable the mod_socache_shmcb since it is used by the ssl mod that I needed:

    You may skip enabling this mod for now but if the following error message, or similar, occurs when you try to restart the Apache HTTP Server, you will have to enable it:
  • Restart the Apache HTTP Server:
  • Verify successful restart by looking in the Apache HTTP Server error log:
  • Verify successful restart by issuing a request on port 80 to your Apache HTTP Server.
    If all is well, a webpage on which there is a message saying “It works!”, among other information.

Congratulations – you have successfully upgraded/installed your Apache HTTP Server 2.4!

7 thoughts on “Upgrading Apache HTTP Server 2.2 to 2.4 on Ubuntu 12.04

  1. Rossi

    I followed this tutorial, which was incredibly helpful. The only problem is I am seeing this error in my log and I am not able to connect using ssl –

    [ssl:warn] [pid 26567:tid 140100459685696] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]

    Any advice?

    Reply
  2. thepanda

    I also had to run:

    apt-get purge apache2-data

    Otherwise apache2 did not install correctly, it kept giving the following error:

    Setting up apache2 (2.4.16-4+deb.sury.org~precise+4) …
    ERROR: Module authn_file does not exist!
    dpkg: error processing apache2 (–configure):
    subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
    apache2

    Reply
  3. Nilesh

    This command is wrong :
    add-apt-repository ppa:ondrej/php5

    It should be :
    add-apt-repository ppa:ondrej/apache2

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *