GZip#
A filter that compresses responses using the gzip method, which allows reducing the size of transmitted data by 2 times or more.
Warning
When using the SSL/TLS protocol, compressed responses may be subject to BREACH attacks.
When building from the source code, the module is built by
default; it can be disabled with the build option
--without-http_gzip_module.
In packages and images from our repositories, the
module is included in the build. The $gzip_ratio variable can be used to log the achieved compression ratio. Enables or disables gzipping of responses. Sets the number and size of buffers used to compress a response. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform. Sets a gzip compression level of a response. Acceptable values are in the range from 1 to 9. Disables gzipping of responses for requests with The special mask Sets the minimum HTTP version of a request required to compress a response. Sets the minimum length of a response that will be gzipped. The length is determined only from the Default http, server, location Enables or disables gzipping of responses for proxied requests depending on the request and response. The fact that the request is proxied is determined by the presence of the disables compression for all proxied requests, ignoring other parameters; enables compression if a response header includes the enables compression if a response header includes the enables compression if a response header includes the enables compression if a response header includes the enables compression if a response header does not include the enables compression if a response header does not include the enables compression if a request header includes the enables compression for all proxied requests. Enables gzipping of responses for the specified MIME types in addition to Enables or disables inserting the "Vary: Accept-Encoding" response header field if the directives gzip, gzip_static or gunzip are active. achieved compression ratio, computed as the ratio between the original and compressed response sizes.Configuration Example#
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml;
Directives#
gzip#
gzip_buffers#
gzip_comp_level#
gzip_disable#
User-Agent header fields matching any of the specified regular expressions.msie6 corresponds to the regular expression "MSIE [4-6].", but works faster. "MSIE 6.0; ... SV1" is excluded from this mask.gzip_http_version#
gzip_min_length#
Content-Length response header field.gzip_proxied#
gzip_proxied off | expired | no-cache | no-store | private | no_last_modified | no_etag | auth | any ...;gzip_proxied off;Via request header field. The directive accepts multiple parameters:offexpiredExpires field with a value that disables caching;no-cacheCache-Control field with the "no-cache" parameter;no-storeCache-Control field with the "no-store" parameter;privateCache-Control field with the "private" parameter;no_last_modifiedLast-Modified field;no_etagETag field;authAuthorization field;anygzip_types#
text/html. The special value "*" matches any MIME type. Responses with the text/html type are always compressed.gzip_vary#
Built-in Variables#
$gzip_ratio#