# # Compression # # The ngx_http_gzip_module 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. # Enables or disables gzipping of responses. # Default: off; gzip on; # 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. # Default 32bit (i386): 32 4k # Default 64bit (x64): 16 8k; #gzip_buffers 16 8k; # Sets a gzip compression level of a response. Acceptable values are in the # range from 1 to 9. # Default: 1 gzip_comp_level 5; # Disables gzipping of responses for requests with “User-Agent” header fields # matching any of the specified regular expressions. # Default: #gzip_disable msie6; # Sets the minimum length of a response that will be gzipped. The length is # determined only from the “Content-Length” response header field. # Default: 20 #gzip_min_length 256; # Sets the minimum HTTP version of a request required to compress a response. # Default: 1.1 #gzip_http_version 1.1; # Enables or disables gzipping of responses for proxied requests depending on # the request and response. # Default: off; gzip_proxied any; # Enables gzipping of responses for the specified MIME types in addition to # “text/html”. The special value “*” matches any MIME type (0.8.29). Responses # with the “text/html” type are always compressed. # Default: text/html gzip_types application/atom+xml application/javascript application/json application/rss+xml# # Gzip Compression # # The ngx_http_gzip_module 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. # Enables or disables gzipping of responses. # Default: off gzip on; # 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. # Default: 16 8k; #gzip_buffers 16 8k; # Sets a gzip compression level of a response. Acceptable values are in the # range from 1 to 9. # 5 is a perfect compromise between size and cpu usage, offering about # 75% reduction for most ascii files (almost identical to level 9). # Default: 1; gzip_comp_level 5; # Disables gzipping of responses for requests with “User-Agent” header fields # matching any of the specified regular expressions. # # The special mask “msie6” (0.7.12) corresponds to the regular expression “MSIE # [4-6]\.”, but works faster. Starting from version 0.8.11, “MSIE 6.0; ... SV1” # is excluded from this mask. # Default: gzip_disable 'msie6'; # Sets the minimum length of a response that will be gzipped. The length is # determined only from the “Content-Length” response header field. # # Don't compress anything that's already small and unlikely to shrink much # if at all (the default is 20 bytes, which is bad as that usually leads to # larger files after gzipping). # Default: 20 #gzip_min_length 256; # Sets the minimum HTTP version of a request required to compress a response. # Default: 1.1 #gzip_http_version 1.1; # 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 “Via” request header field. The directive accepts # multiple parameters: # off | expired | no-cache | no-store | private | no_last_modified | # no_etag | auth | any # # Compress data even for clients that are connecting to us via proxies, # identified by the "Via" header (required for CloudFront). # Default: off gzip_proxied any; # Enables gzipping of responses for the specified MIME types in addition to # “text/html”. The special value “*” matches any MIME type. # Responses with the “text/html” type are always compressed. # # Compress all output labeled with one of the following MIME-types. # text/html is always compressed by HttpGzipModule # Default: text/html; gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component; # Tell proxies to cache both the gzipped and regular version of a resource # whenever the client's Accept-Encoding capabilities header varies; # Avoids the issue where a non-gzip capable client (which is extremely rare # today) would display gibberish if their proxy gave them the gzipped version. gzip_vary on; # This should be turned on if you are going to have pre-compressed copies # (.gz) of static files available. If not it should be left off as it will # cause extra I/O for the check. It is best if you enable this in a location{} # block for a specific directory, or on an individual server{} level. #gzip_static on; application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component; # Tell proxies to cache both the gzipped and regular version of a resource # whenever the client's Accept-Encoding capabilities header varies; # Avoids the issue where a non-gzip capable client (which is extremely rare # today) would display gibberish if their proxy gave them the gzipped version. gzip_vary on;