Yesterday I posted a blog about how to encrypt your connection and being granted with an A+ label for the effort you did. For having a modern blog on reasonable webserver the last step to do is enable HTTP/2[1] on the primary webserver Nginx.


  • Nginx version 1.9.6 or higher with --with-http_v2_module enabled
  • Having set SSL in the correct way. All implementations of HTTP/2 require HTTPS, see guide here

Steps to take:

Make sure your version of Nginx is compiled with HTTP/2 support:

$ nginx -V

Make sure you can find the --with-http_v2_module somewhere in that output. If you don’t, upgrade to a build that supports HTTP/2.

From here it is as simple as adding a single word to your Nginx config. Edit the config file where the server{} code block for your HTTPS site is:

$ cd /etc/nginx/sites-available
$ sudo nano your-https-site-config-file

You need to change the two lines where listen is written. On these lines you need to append the word http2 before the ; , check the example:

server {
  # SSL configuration
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

Test and reload the Nginx service and your are done!

$ sudo nginx -t
$ sudo service nginx restart

From now on all HTTP/2 enabled visitors should get your website delivered over HTTP/2, while older browsers getting your website the backwards compatible HTTP. To check if everything is fine I installed an extension on Google Chrome called 'HTTP/2 and SPDY[1:1] indicator' which you can checkout here. This extension shows a lightning icon in the address bar that's blue if the page is HTTP/2 enabled, green if the page is SPDY enabled, and optionally grey if neither is available. See for your self:

picture of lightning icon in address bar

I hope this was useful and thanks for stopping by.

  1. SPDY = (pronounced speedy) is an open networking protocol developed primarily at Google for transporting web content. ↩︎ ↩︎