Enable HTTP/2 in nginx

Enabling HTTP/2 in nginx is quite simple. You need to add the http2 parameter to the listen 443 directive. So find the line that looks like:

listen 443 ssl;

and change it into

listen 443 ssl http2;

And reload your nginx configuration:

$ sudo systemctl reload nginx.service 

Few notes:

  • You only need to enable http2 in one of your server blocks. You don’t need to do so for every virtual server (unless they use a different port). See here.
  • Don’t add http2 to your port 80. Browsers don’t support unencrypted.

One thought on “Enable HTTP/2 in nginx”

Leave a Reply

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