=encoding utf-8 =head1 NAME ngx_http_gzip_module - Module ngx_http_gzip_module =head1 The C module is a filter that compresses responses using the “gzip” method. This often helps to reduce the size of transmitted data by half or even more. =head1 Example Configuration gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml; The C<$gzip_ratio> variable can be used to log the achieved compression ratio. =head1 Directives =head2 gzip B gzip I E C> B I B I B I B I B I Enables or disables gzipping of responses. =head2 gzip_buffers B gzip_buffers I> I>> B I<32 4kE16 8k> B I B I B I Sets the I> and I> 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. B Until version 0.7.28, four 4K or 8K buffers were used by default. =head2 gzip_comp_level B gzip_comp_level I>> B I<1> B I B I B I Sets a gzip compression I> of a response. Acceptable values are in the range from 1 to 9. =head2 gzip_disable B gzip_disable I> ...> B I B I B I This directive appeared in version 0.6.23. Disables gzipping of responses for requests with C header fields matching any of the specified regular expressions. The special mask “C” (0.7.12) corresponds to the regular expression “C”, but works faster. Starting from version 0.8.11, “C” is excluded from this mask. =head2 gzip_min_length B gzip_min_length I>> B I<20> B I B I B I Sets the minimum length of a response that will be gzipped. The length is determined only from the C response header field. =head2 gzip_http_version B gzip_http_version I E C<1.1>> B I<1.1> B I B I B I Sets the minimum HTTP version of a request required to compress a response. =head2 gzip_proxied B gzip_proxied I< C E C E C E C E C E C E C E C E C ...> B I B I B I B I 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 C request header field. The directive accepts multiple parameters: =over =item C disables compression for all proxied requests, ignoring other parameters; =item C enables compression if a response header includes the C field with a value that disables caching; =item C enables compression if a response header includes the C field with the “C” parameter; =item C enables compression if a response header includes the C field with the “C” parameter; =item C enables compression if a response header includes the C field with the “C” parameter; =item C enables compression if a response header does not include the C field; =item C enables compression if a response header does not include the C field; =item C enables compression if a request header includes the C field; =item C enables compression for all proxied requests. =back =head2 gzip_types B gzip_types I> ...> B Ihtml> B I B I B I Enables gzipping of responses for the specified MIME types in addition to “Chtml>”. The special value “C<*>” matches any MIME type (0.8.29). Responses with the “Chtml>” type are always compressed. =head2 gzip_vary B gzip_vary I E C> B I B I B I B I Enables or disables inserting the C response header field if the directives L, L, or L are active. =head1 Embedded Variables =over =item C<$gzip_ratio> achieved compression ratio, computed as the ratio between the original and compressed response sizes. =back