Exploring the directives of HTTP/2
NGINX added support for HTTP/2 in version 1.9.5
and superseded the SPDY (pronounced SPeeDY) module, meaning that, as of 1.9.5
, SPDY is no longer available, and we now have to use HTTP/2.
If you installed NGINX via a package manager, this module is most likely enabled; if you compiled it yourself, please make sure you compiled NGINX using the --with_http_v2_module
configure flag.
Similarly to SPDY, HTTP/2 requires the use of SSL, which is good practice regardless. These days, SSL certificates can be issued for free by services such as Let’s Encrypt, so this is highly recommended.
To enable HTTP/v2, add the http2
flag to the listen
directive:
listen 443 ssl http2;
Let’s explore the different module directives in this section.
http2_chunk_size
Context: http
, server
, and location
Sets the maximum size of chunks into which the response body is sliced.
Syntax: Size
Default value: 8k