> For the complete documentation index, see [llms.txt](https://docshome.gitbook.io/nginx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docshome.gitbook.io/nginx-docs/he-xin-gong-neng/http/ngx_http_gunzip_module.md).

# ngx\_http\_gunzip\_module

* [示例配置](/nginx-docs/he-xin-gong-neng/http/ngx_http_gunzip_module.md#example_configuration)
* [指令](/nginx-docs/he-xin-gong-neng/http/ngx_http_gunzip_module.md#directives)
  * [gunzip](/nginx-docs/he-xin-gong-neng/http/ngx_http_gunzip_module.md#gunzip)
  * [gunzip\_buffers](/nginx-docs/he-xin-gong-neng/http/ngx_http_gunzip_module.md#gunzip_buffers)

`ngx_http_gunzip_module` 模块是一个过滤器，用于对不支持 **gzip** 编码方法的客户端解压缩 `Content-Encoding：gzip` 的响应。当需要存储压缩数据以节省空间并降低 I/O 成本时，该模块将非常有用。

此模块不是默认构建，您可以使用 `--with-http_gunzip_module` 配置参数启用。

## 示例配置 <a href="#example_configuration" id="example_configuration"></a>

```
location /storage/ {
    gunzip on;
    ...
}
```

## 指令 <a href="#directives" id="directives"></a>

### gunzip

|       - | 说明                        |
| ------: | ------------------------- |
|  **语法** | **gunzip** `on` \| `off`; |
|  **默认** | gunzip off;               |
| **上下文** | http、server、location      |

对缺少 gzip 支持的客户端启用或禁用 gzip 响应解压缩。如果开启，在确定客户端是否支持 gzip 时还会考虑以下指令：[gzip\_http\_version](/nginx-docs/he-xin-gong-neng/http/ngx_http_gzip_module.md#gzip_http_version)、[gzip\_proxied](/nginx-docs/he-xin-gong-neng/http/ngx_http_gzip_module.md#gzip_proxied) 和 [gzip\_disable](/nginx-docs/he-xin-gong-neng/http/ngx_http_gzip_module.md#gzip_disable)。另请参阅 [gzip\_vary](/nginx-docs/he-xin-gong-neng/http/ngx_http_gzip_module.md#gzip_vary) 指令。

### gunzip\_buffers

|       - | 说明                                 |
| ------: | ---------------------------------- |
|  **语法** | **gunzip\_buffers** `number size`; |
|  **默认** | gunzip\_buffers 32 4k\|16 8k;      |
| **上下文** | http、server、location               |

设置用于解压响应的缓冲区的数量（`number`）和大小（`size`）。默认情况下，缓冲区大小等于一个内存页（4K 或 8K，取决于平台）。

## 原文档

<http://nginx.org/en/docs/http/ngx_http_gunzip_module.html>
