HTTP/2 was published in May 2015. The advantage of HTTP/2 is its high transfer speed for content-rich websites. Most probably your website serves tons of CSS, JS and images, so why not using HTTP/2?
Main features of HTTP/2
- All requests are downloaded in parallel without forming a queue.
- HTTP headers are compressed.
- Pages are fetched as a binary, not as a text file, which is more efficient.
- NGINX 1.9.5 and later.
- A valid SSL certificate.
NGINX has been supporting HTTP/2 since version 1.9.5, so let's ensure we're up-to-date:
$ nginx -v nginx version: nginx/1.10.1
We will be using the NGINX config file from one of the previous posts about configuring NGINX for SSL.
That will be a no-brainer sort of change. We only need to replace two following lines:
listen 443; listen [::]:443;
listen 443 ssl http2; listen [::]:443 ssl http2;
Next, we should restart the server.
Let's test to ensure that our content is really served via HTTP/2.
That's it, we've got a lightning-fast HTTP/2 website. Welcome to 2017!