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
- You only need to enable
http2in 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
http2to your port 80. Browsers don’t support unencrypted.
One thought on “Enable HTTP/2 in nginx”
You don’t need “ssl”. In updated nginx ssl enabled automatically in port 443.
The line is: listen 443 http2;