Enable HTTP/2 in Nginx

0 Flares Filament.io 0 Flares ×

As of now HTTP/2 protocol is approved and published which is faster then older protocol so its a good time to implement HTTP/2 on your website. Good thing is that all major servers and browsers are already compatible with it so we are good to go. If you are curious check the current compatibility list here.

I am usingĀ Ubuntu 14.04.3 LTS and Nginx Mainline v1.9.6. The installation is simple as you just need to install Nginx version 1.9.5 or higher compiled with ‘–with-http_v2_module‘ option.

Nginx 1.9.5 or higher compiled with ‘–with-http_v2_module
TLS enabled website

To install create /etc/apt/sources.list.d/nginx.list and add Nginx official repositories to it.

deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx

Adding key and install Nginx latest mainline version.

wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
apt-get update
apt-get install nginx

Once Nginx is installed you just need to update your HTTPS listener in your vhost as below and your website is now ready to take advantages of HTTP/2 benefits.

'listen 443 ssl http2;'

Note: If you were using SPDY then you need to remove ‘spdy’ from your listener and simply replace it from ‘http2′, if you are passing any headers related to SPDY then also remove them.

0 Flares Twitter 0 Facebook 0 LinkedIn 0 Google+ 0 Filament.io 0 Flares ×

Leave a Reply

Your email address will not be published. Required fields are marked *