Enabling HTTP2 in NGINX Web Server – Detailed Guide

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Enabling HTTP2 in NGINX Web Server

Learn how you can boost user experience by using HTTP2 on the NGINX server!

HTTP/2 is the fourth and most advanced version of HTTP. If you are inclined towards implementing the HTTP2 NGINX combination, it is an ideal pick. HTTP2 is a protocol that is best for a resource-intensive website. Moreover, the use of the NGINX server acts as a cherry on the cake.

In today’s world, where every business is trying to capture user attention via powerful and immersive content. The use of NGINX HTTP2 Proxy combination is imperative. How can you do it? Let’s read ahead and find out!

What is NGINX?

If we talk about NGINX, it is an exceptional web and reverse proxy server that has remarkable features as compared to its competitor, Apache.

Though there is a tough knock between the two, NGINX has officially overtaken Apache. As per stats, NGINX is used by 34% of the websites, whereas Apache is used by 33.1%.

Individually, NGINX is a great choice, but if you compare it with Apache, there are many benefits!

  1. It handles static content requests better than Apache and can serve more clients at the same time.
  2. It is a better solution in the case of caching, load balancing, and reverse proxy.

Here are some features of NGINX in detail!

  1. Load balancing: One of the key USPs of NGINX is load balancing. The load balancing feature of the NGINX server ensures that all the traffic to the website is handled well. It does this by distributing the request to multiple servers. Obviously, the website should have multiple servers at the backend.
  • Reverse proxy: If the site has one server, it is wise to use a reverse proxy. A reverse proxy ensures that all the server requests go through it first. It receives the client’s request and forwards it to the appropriate server. Reverse proxy empowers the website with performance, scalability, and security.
  • Caching: Caching data helps servers provide content faster, but it also overloads the server sometimes. Hence, the NGINX server caches the data, but only for a limited time. This directly boosts the speed of content delivery and reduces server overload.

Other than these, the NGINX server has features like IPV6 support, web sockets, URL rewriting, and auto-indexing.

How to Enable the HTTP2 NGINX Combination in a Web Server?

Once you have an understanding of HTTP2 and NGINX, the enabling process becomes easy. To implement the HTTP2 NGINX combo, keep in mind these prerequisites!

  1. Make sure you have HTTPS enabled on the server. Browsers permit HTTP2 only over HTTPS.
  2. Make sure that the installed NGINX version is 1.9.5 or more. HTTP2 is supported by NGINX version 1.9.5 and above.

Steps to Enable the NGINX HTTP 2 Combination!

  1. Open the configuration file for NGINX: Run the following command in the terminal to open the NGINX configuration file.

sudo vi /etc/nginx/nginx.conf

If the virtual host (/etc/nginx/sites-enabled/alpha.conf) for your website (e.g. www.alpha.com), the command will be

sudo vi /etc/nginx/sites-enabled/alpha.conf

  • Setup HTTP2: In an SSL-enabled server, you will see the following code.

listen 443 ssl;

You have to change it to listen 443 ssl http2; to enable HTTP2!

The server block will be like this!

server {

    listen 443 ssl http2;

    ssl_certificate …

    ssl_certificate_key …


  • Restart the NGINX Server: Before you restart the server, you need to verify the syntax of the configuration file you just updated. Run sudo nginx -t command to do that. After this, enter the following command to restart the NGINX server.

sudo service nginx reload #debian/ubuntu

$ systemctl restart nginx #redhat/centos

  • Verify HTTP2: After the last step, you can use any third-party tool online to check if HTTP2 is enabled or not. When you enter the HTTPS website URL, the tool will tell you if HTTP2 is enabled on the server or not.


In the wrap-up, we can say that the process of NGINX Enable HTTP2 is pretty easy. Moreover, the need to enable HTTP2 is also critical if the website is resource intensive. To ensure that the implementation of the HTTP2 NGINX combination is stress-free, make sure that the SSL certificate is installed on the NGINX web server.

To get the best and most affordable SSL certificate for your site’s server, choose Cheapsslweb.com.

Janki Mehta

Janki Mehta

Janki Mehta is a Cyber-Security Enthusiast who constantly updates herself with new advancements in the Web/Cyber Security niche. Along with theoretical knowledge, she also implements her practical expertise in day-to-day tasks and helps others to protect themselves from threats.

Buy Cheap Wildcard SSL