Nginx ngx_http_gunzip_module模块基本指令整理

原创文章,转载请指明出处并保留原文url地址

本文主要针对nginx的ngx_http_gunzip_module模块做简单介绍,本文具体包括如下指令:

Gunzip,gunzip_buffers

ngx_http_gunzip_module是个过滤模块,这个模块为那些不支持gzip模块的客户端解压缩gzip格式相应的相应。这个模块对存储压缩存储的数据以及节省磁盘空间及减少I/O等有很大好处。这个模块不是默认的内建模块,他需要通过--with-http_gunzip_module配置指令进行配置。

配置示例

location /storage/ {

gunzip on;

...

}

Nginx原文:

The ngx_http_gunzip_module module is a filter that decompresses responses with “Content-Encoding: gzip” for clients that do not support “gzip” encoding method. The module will be useful when it is desirable to store data compressed, to save space and reduce I/O costs.

This module is not built by default, it should be enabled with the --with-http_gunzip_module configuration parameter.

Example Configuration

location /storage/ {

gunzip on;

...

}

1. Gunzip

syntax:Gunzip     on | off;
default:gunzip off;
context:http, server, location

启用或者禁止为那些缺乏gzip功能支持的客户端提供解压缩服务。如果功能被打开,下面的一些指令被考虑是客户端支持gzip功能, 指令包括:: gzip_http_version, gzip_proxied, and gzip_disable, 另外可以参见gzip_vary指令。

Nginx原文:

Enables or disables decompression of gzipped responses for clients that lack gzip support. If enabled, the following directives are also taken into account when determining if clients support gzip: gzip_http_version, gzip_proxied, and gzip_disable. See also the gzip_vary directive.

2. gunzip_buffers

syntax:gunzip_buffers    numbersize;
default:gunzip_buffers 32 4k|16 8k;
context:http, server, location

设置缓冲用于解压相应的缓冲的数目及大小。默认情况缓冲大小等于内存页的大小。这个大小有可能是4K或者8K,具体取决你的平台。

Sets the number and size of buffers used to decompress a response. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform.

发表评论