As you will have seen recently we have been doing a bit of server upgrading. At the core of this upgrade is Nginx and HTTP2 support.

Now if your starting from scratch I recommend upgrading Nginx before adding your sites, it just makes things easier, you wont need to remove Nginx first and reinstall.

At the time of writing Ubuntu 14 comes with Nginx 1.4, old yes but stable. To take advantage of new features include HTTP2 we need to upgrade that to Nginx 1.9.

1.9 is currently not the stable version of nginx 1.8 is. 1.9 is classed as “mainline” which loosely translates to development. However according the Nginx website “mainline” (develop) doesn’t mean unstable, your more likely to get bug fixes faster on mainline than you are on the stable version.

Nginx Upgrade

Before we upgrade, first lets take a copy of the main /etc/nginx/nginx.conf file:

sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup

Stop Nginx

sudo service nginx stop

Then we need to add the new apt repository:

sudo add-apt-repository ppa:nginx/development && sudo apt-get update

Then upgrade nginx (cross fingers)

sudo apt-get remove nginx nginx-common && sudo apt-get install nginx

At this point you should be good to go:

sudo service nginx restart && sudo service nginx reload

If all goes well your sites should be working as normal.

However if like me you chose Y when installing the install process will overwrite your nginx.conf file with a newer version, and this gave me a headache for a few minutes.

  1. The default Nginx user changes from www-data to nginx, you will need to alter your config, or file permissions occordingly.
  2. The new nginx.conf file doesn’t include config files located in /etc/nginx/sites-enabled. It’s an easy fix just add include /etc/nginx/sites-enabled/*; just before the closing curly brace.


HTTP2 is a new version of web. Well sort of, how it works, and what it really does is out of the scope of this article, but what it does do is increase performance of your website by reusing connections. Most new browsers support HTTP2 so we can already benefit from the speed increase.

As a side note HTTP2 will only work with SSL enabled sites, so take a gander at our LetEncrypt article to get that setup.

Now for the in-depth instructions on enabling HTTP2 support.

In all of your sites Nginx config files, find the lines:

listen 443 ssl;

And change them to:

listen 443 ssl http2;

Reload Nginx and your good to go:

sudo service nginx restart && sudo service nginx reload

And with that your done! HTTP2 support is enabled.

Bonus Point

There is a chrome extension called HTTP/2 and SPDY indicator which adds a little lightning bolt to your browser to tell you when your on a HTTP2 enabled site.

The full command list has been wrapped up in a nice little gist for you to reference: