模块 ngx_http_gzip_static_module
配置示例 指令 gzip_static |
ngx_http_gzip_static_module
模块允许发送带有 “.gz” 文件名扩展名的预压缩文件,而不是普通文件。
此模块默认不构建,需要通过使用 --with-http_gzip_static_module
配置参数来启用。
配置示例
gzip_static on; gzip_proxied expired no-cache no-store private auth;
指令
语法 |
gzip_static |
---|---|
默认 |
gzip_static off; |
作用域 |
http , server , location |
启用(“on
”)或禁用(“off
”)对预压缩文件存在性的检查。以下指令也会被考虑进去:gzip_http_version、gzip_proxied、gzip_disable 和 gzip_vary。
当值为“always
”(1.3.6 版本加入)时,总是在所有情况下使用 gzipped 文件,而不检查客户端是否支持它。如果磁盘上本来就没有未压缩的文件,或者使用了 ngx_http_gunzip_module 模块,这很有用。
这些文件可以使用 gzip
命令或任何其他兼容的命令来压缩。建议原始文件和压缩文件的修改日期和时间保持一致。