How to upgrade to HTTP2 on Ubuntu 14.04

Posted 3 years ago

This post doesn’t cover the fact you need a working SSL certificate on your server (delivering over HTTPS).

Run the below commands, one at a time to download apache2, update packages and finally enable the http2 mod.

sudo -i
apt-get install python-software-properties
add-apt-repository -y ppa:ondrej/apache2
apt-key update
apt-get update
apt-get --only-upgrade install apache2 -y
a2enmod http2

Edit your virtual hosts file, on some systems you’ll be able to find them here “/etc/apache2/sites-available” you can find out more about locating files here

<VirtualHost *:443>
 # Protocols for enabling http2 over https
 Protocols h2 http/1.1

 # Other configuration files in virtual hosts file
 # ...

Finally, restart apache.

service apache2 restart

Check if http2 is enabled

To check if http2 is working there’s a few method we can use. If you’re using chrome, there’s a handy plugin called HTTP/2 and SPDY indicator. I use this online tool

From the command line

npm install -g is-http2-cli

Once you’ve installed “is-http2”  run the below command and the result will be whether http2 is supported or not.

× HTTP/2 not supported by
Supported protocols: http/1.1