Hypertext Transfer Protocol Version 2 (HTTP2), defined in RFC 7540 improves website performance and enables a more efficient use of network resources. Unlike its predecessor, HTTP/1.1, HTTP/2 can handle heavy loads of resources such as images, fonts, scripts, and stylesheets which result in better load speeds. It reduces latency by introducing header field compression and enables multiplexing, which allows the client and server to process multiple concurrent requests over the same connection.
- Open your configuration file (we will use
default.conf
as an example) - Edit the listen direction by adding http2. It should look like the following assuming you are using both IPv4 and IPv6.
listen 443 http2 ssl; listen [::]:443 http2 ssl;
- Save file and restart NGINX
- RFC 7540 - Hypertext Transfer Protocol Version 2 (HTTP/2)
- HTTP/2 site - IETF HTTP Working Group
- Introduction to HTTP/2 - Google
Note: Developed on a server running Debian 10.2 and NGINX 1.14.2.
This documentation is part of the Internet Society's Open Standards Everywhere project. To find the most recent version or to provide feedback, please visit https://github.com/InternetSociety/ose-documentation