Enabling TLS v1.3, HTTP2, and Push on Apache 2

Keeping the server spec up to date take regular effort. In this post we will discuss how to set up and enable some of the most recent web technologies.

Before we get Apache configured, a note: If you are using PHP on Apache utilizing mod_php, you probably have mpm_prefork enabled. HTTP2 doesn’t work well (in my case, not at all) with mpm_prefork.

Also, this is written for Ubuntu. Getting an updated version of Apache will be different for your variant of Linux.

Step 0 – Switch from mod_php to php-fpm and from mpm_prefork to mpm_event.

Switching from mod_php to php-fpm, this was a good chance for me to upgrade to PHP 7.3 from PHP 7.2.

The PHP installation script give me what I consider a standard setup, workable from CGI, FPM, and CLI. Also it has support for MySQL, PQ/SQL, and SQLite. Alter the installation to fit what you need. At a minimum I would suggest the following.

Step 1 – Enable the Updated Apache Repo

Adding the up-to-date Apache repository is fairly easy and strait forward.

Step 2 – Enable http2

Here’s a 1-liner for you.

Of course you’ll need to restart Apache

Step 3 – Double Check SSL Configuration

There are many places you can configure your SSL configuration for Apache. Let’s walk through them, or at least the defaults. If you have your SSL config in a different conf file, that’s your beast to deal with.

We are looking for a setting called SSLProtocol.

Normally the setting is in this config file. A good value is all -SSLv3 -TLSv1. A better value is all -SSLv3 -TLSv1 -TLSv1.1.

Check this file first: /etc/apache2/mods-available/ssl.conf Here is what mine looks like.

 

If you are using LetsEncrypt, look in: /etc/letsencrypt/options-ssl-apache.conf LetsEncrypt does like to whine if you modify its config file, just take a look at the beginning of that file:

Instead, I decided that it would be better for me to disable the LetsEncrypt config file in my vhosts files.

The last place to look is in your vhosts file themselves.

Step 4 – Restart Apache

Step 5 – Test

There are many HTTP2 testers out there. You can Google for one. Here’s a few that worked for me:

https://tools.keycdn.com/http2-test

https://http2.pro/

https://tools.geekflare.com/tools/http2-test

There are also many SSL testers out there. Again, Google or use what I use:

https://www.immuniweb.com/ssl formerly https://htbridge.com/ssl/

https://www.ssllabs.com/ssltest

I am not affiliated with any of these.

Results

Your server is now using TLS 1.3 and HTTP2. It is ready for ALPN and Push too!