How to Enable HTTP/2.0 Support on Nginx Web Server

3) Enable HTTP2 Support

By default, the HTTP/2 protocol support is not added in Nginx and we need to add the below lines to particular virtualhost (Like 2daygeek.conf). For more configuration in Nginx wiht HTTP/2

[Just add http2 in listing line]
listen 443 ssl http2;

[Modify your certificate location]
ssl on;
ssl_certificate  /etc/nginx/ssl/example.com.crt;
ssl_certificate_key   /etc/nginx/ssl/example.com.key;

Note Make sure, you should install and configure SSL with nginx to work HTTP2.

4) Verify HTTP2 module

All the configuration got over, now times to check the status whether its working or not.

[ac-box color=”lred” icon=”fa-exclamation-circle”]
All the browsers are support HTTP2 with HTTPS Protocol. So, Make sure you should install HTTPS support on your server to enjoy/avail the HTTP2 features.
[/ac-box]

See the below screen shot, here i’m going to check via Firefox browser. how to check >> Tools >> Web Developer >> Network >> Choose the domain name “In my case its (localhost) with 200 GET status code”. Also you can verify by adding SPDY Indicator Add-on in Mozilla Firefox browser.
enable-http2-support-in-nginx-firefox
Alternatively we can check by Google chrome browser by navigating the link chrome://net-internals/#http2
enable-http2-support-in-nginx-google-chrome
See the detailed info from Google Chrome browser.
enable-http2-support-in-nginx-google-chrome-1
Hope, here after you also will migrate your server to HTTP2 for super fast & safer Internet.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

2 Comments on “How to Enable HTTP/2.0 Support on Nginx Web Server”

  1. Nice, article.

    There’s one catch.

    The Centos 7 nginx repo is built against OpenSSL 1.0.1. This version of OpenSSL only supports NPN and not ALPN. This means the faster secure handshakes you mentioned aren’t supported. The only work around is to recompile nginx from source and build it against OpenSSL 1.0.2 (which does support ALPN). Unfortunately, compiling and updating from source creates it’s own hassles.

    Yes…you can go the centminmod route…but I haven’t tested this enough to know if it will break anything else.

    I wish Nginx provided a repo that statically links in OpenSSL 1.0.2. This would really be ideal.

    Also hoping Nginx adds http2 push.

Leave a Reply

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