How To Install PHP 7.4 and PHP 7.3 ON Ubuntu 18.04/19.04/16.04

banner image

Make much faster Nginx with enable HTTP/2

Hypertext Transfer Protocol Version 2 (HTTP/2) is the latest version of the HTTP protocol, published as an IETF standard in RFC 7540 in 2015.

Why HTTP/2 need to update? 

HTTP/2 is much faster than HTTP/1.1.
The HTTP/2 protocol achieves this by enabling web browsers to send multiple, simultaneous requests to the server.  In order to make use of HTTP/2, you must jump through a few steps.


Must need Nginx version 1.9.5 or greater. You can check your Nginx version by running (nginx -v) command.

OpenSSL version 1.0.2 or greater. You can check your OpenSSL version by running (OpenSSL version) command.

SSL/TLS certificate from Let's Encrypt or a self-signed certificate.
TLS 1.2 or higher protocol enabled. Otherwise, you will not be able to use HTTP/2. Implementations of HTTP/2 must use TLS version 1.2 or higher for HTTP/2 over TLS.

See : How to install and use Let's Encrypt on a Linux Server.

Enable HTTP/2 in Nginx

To enable HTTP/2 in Nginx, we have to add the http2 parameter to the listen directive in our virtual host:

listen 443 ssl http2;
And reload your Nginx configuration:

sudo systemctl reload nginx.service

Here is the minimal virtual server configuration that can be used to enable HTTP/2 in some virtual host:

server {

  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  root /path/to/public;

  ssl_certificate /path/to/certificate.crt;
  ssl_certificate_key /path/to/private.key;

  ssl_protocols TLSv1.2;



To check if your server supports HTTP/2, you can use your browser dev tools or Nginx log files. The below is a screenshot from Google Chrome browser that shows HTTP/2 in action on domain.


And that's all there is to enabling HTTP/2 on your Nginx server.

Make much faster Nginx with enable HTTP/2 Make much faster Nginx with enable HTTP/2 Reviewed by Raj on February 11, 2019 Rating: 5

No comments:

Powered by Blogger.