HTTP/2 with Apache

If you haven’t already converted your webserver to support HTTP2, it’s about time to get this process done. Enabling support for HTTP2 on your website and webserver is a very easy process. It shouldn’t take more than a few minutes and cause almost no down-time.

The process to configure your Apache web server to support HTTP2 is simple. During this process we will be adding repositories to our package manager lists. We will be updating your package manager and then install a few software packages. At that point we will be performing some minor configuration changes. These instructions are listed for Ubuntu 18.04 LTS but should be mostly compatible with derivative OSes that uses this Linux distribution as it’s base.

So, let’s open your favorite CLI and get started. We assume that the apache2 module is already installed on your server and running. Furthermore, you should make sure to have an Apache version >=2.4.29 since earlier versions do not support HTTP/2. If you want to check your Apache version simply type:

If you find an Apache version <=2.4.29 you find instructions how to update Apache here: Upgrade Apache for HTTP/2. Otherwise your are ready to continue with the following steps.

First you have to install the SSL and HTTP/2 module. SSL is requiread by the HTTP/2 protocol:

Next you have to tell Apache to use the HTTP/2 protocol if the client supports it. To do so open the apache configuration file with a text editor of your choice. Usually you will find it at the location:


The only thing you have to do is to add the following lines to this configuration.

You can do this either globally or for a particular virtual host only. A basic virtual host configuration for HTTP/2 looks like follows:

Finally you have to restart Apache to enable the HTTP/2 support:

Testing:

To verify if your upgrade was successful simply use our free HTTP/2 test.

Thats it! You are done with enabling HTTP/2 support for your apache server.

Troubleshooting:

If the test shows a negative result check your servers log files. The following post might be helpful:

How to fix AH10034: the mpm module prefork.c is not supported