Enable HTTP/2 in Nginx

For Nginx 1.9.5 and later, change

listen 443 ssl;

to
listen 443 ssl http2;

and you are all set.

Note that all implementations of HTTP/2 require HTTPS.

Ubuntu 16.04 LTS already comes with Nginx 1.10.

To automatically renew certificates from letsencrypt, just run

sudo /path/to/letsencrypt-auto renew 1>/dev/null 2>&1 && sudo nginx -s reload

periodically if you have initiated the configurations correctly. 🙂

By the way, enabling HTTP/2 does not seem to bring any good to my websites. However it does make me feel good. 😉