Using 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/v add the http2
flag to the listen directive:
listen 443 ssl http2;
Module directives
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
http2_body_preread_size
Context: http
, and server
Sets the size of the request buffer in which the...