RuHttpGzipModule
Contents |
[edit] ngx_http_gzip_module
袦芯写褍谢褜 ngx_http_gzip_module - 褝褌芯 褎懈谢褜褌褉, 褋卸懈屑邪褞褖懈泄 芯褌胁械褌 屑械褌芯写芯屑 gzip, 褔褌芯 锌芯蟹胁芯谢褟械褌 褍屑械薪褜褕懈褌褜 褉邪蟹屑械褉 锌械褉械写邪胁邪械屑褘褏 写邪薪薪褘褏 胁 2 懈 斜芯谢械械 褉邪蟹. 小芯写械褉卸邪薪懈械 袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈
[edit] 袛懈褉械泻褌懈胁褘
- [#gzip gzip]
- [#gzip_buffers gzip_buffers]
- [#gzip_comp_level gzip_comp_level]
- [#gzip_min_length gzip_min_length]
- [#gzip_http_version gzip_http_version]
- [#gzip_proxied gzip_proxied]
- [#gzip_types gzip_types]
袩褉懈屑械褉 泻芯薪褎懈谐褍褉邪褑懈懈
: gzip on; : gzip_min_length 1000; : gzip_proxied expired no-cache no-store private auth; : gzip_types text/plain application/xml;
袛谢褟 蟹邪锌懈褋懈 胁 谢芯谐 褋褌械锌械薪懈 褋卸邪褌懈褟 屑芯卸薪芯 懈褋锌芯谢褜蟹芯胁邪褌褜 锌械褉械屑械薪薪褍褞 $gzip_ratio. 袛懈褉械泻褌懈胁褘
[edit] gzip
syntax: gzip on|off
default: gzip off
context: http, server, location, if 胁 location
袪邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 褋卸邪褌懈械 芯褌胁械褌邪 屑械褌芯写芯屑 gzip.
[edit] gzip_buffers
syntax: gzip_buffers 褔懈褋谢芯 褉邪蟹屑械褉
default: gzip_buffers 4 4k/8k
context: http, server, location
袛懈褉械泻褌懈胁邪 蟹邪写邪褢褌 褔懈褋谢芯 懈 褉邪蟹屑械褉 斜褍褎械褉芯胁, 胁 泻芯褌芯褉褘械 斜褍写械褌 褋卸懈屑邪褌褜褋褟 芯褌胁械褌. 袩芯 褍屑芯谢褔邪薪懈褞 褉邪蟹屑械褉 芯写薪芯谐芯 斜褍褎械褉邪 褉邪胁械薪 褉邪蟹屑械褉褍 褋褌褉邪薪懈褑褘, 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 锌谢邪褌褎芯褉屑褘 褝褌芯 懈谢懈 4K, 懈谢懈 8K.
[edit] gzip_comp_level
syntax: gzip_comp_level 1..9
default: gzip_comp_level 1
context: http, server, location
校褋褌邪薪邪胁谢懈胁邪械褌 褍褉芯胁械薪褜 褋卸邪褌懈褟 芯褌胁械褌邪 屑械褌芯写芯屑 gzip.
[edit] gzip_min_length
syntax: gzip_min_length 写谢懈薪邪
default: gzip_min_length 0
context: http, server, location
校褋褌邪薪邪胁谢懈胁邪械褌 屑懈薪懈屑邪谢褜薪褍褞 写谢懈薪褍 芯褌胁械褌邪, 写谢褟 泻芯褌芯褉褘褏 斜褍写械褌 胁褘锌芯谢薪褟褌褜褋褟 褋卸邪褌懈械 芯褌胁械褌邪 屑械褌芯写芯屑 gzip. 袛谢懈薪邪 芯锌褉械写械谢褟械褌褋褟 褌芯谢褜泻芯 懈蟹 褋褌褉芯泻懈 "Content-Length" 蟹邪谐芯谢芯胁泻邪 芯褌胁械褌邪.
[edit] gzip_http_version
syntax: gzip_http_version 1.0|1.1
default: gzip_http_version 1.1
context: http, server, location
袪邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 褋卸邪褌懈械 芯褌胁械褌邪 屑械褌芯写芯屑 gzip 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 胁械褉褋懈懈 蟹邪锌褉芯褋邪.
[edit] gzip_proxied
syntax: gzip_proxied [off|expired|no-cache|no-store|private|no_last_modified|no_etag|auth|any] ...
default: gzip_proxied off
context: http, server, location
袪邪蟹褉械褕邪械褌 懈谢懈 蟹邪锌褉械褖邪械褌 褋卸邪褌懈械 芯褌胁械褌邪 屑械褌芯写芯屑 gzip 写谢褟 锌褉芯泻褋懈褉芯胁邪薪薪褘褏 蟹邪锌褉芯褋芯胁 胁 蟹邪胁懈褋懈屑芯褋褌懈 芯褌 蟹邪锌褉芯褋邪 懈 芯褌胁械褌邪. 孝芯 褔褌芯, 蟹邪锌褉芯褋 锌褉芯泻褋懈褉芯胁邪薪薪褘泄, 芯锌褉械写械谢褟械褌褋褟 薪邪 芯褋薪芯胁邪薪懈懈 褋褌褉芯泻懈 "Via" 胁 蟹邪谐芯谢芯胁泻械 蟹邪锌褉芯褋邪. 袙 写懈褉械泻褌懈胁械 屑芯卸薪芯 褍泻邪蟹邪褌褜 芯写薪芯胁褉械屑械薪薪芯 薪械褋泻芯谢褜泻芯 锌邪邪褉屑械褌褉芯胁:
- off 鈥 蟹邪锌褉械褖邪械褌 褋卸邪褌懈械 写谢褟 胁褋械褏 锌褉芯泻褋懈褉芯胁邪薪薪褘褏 蟹邪锌褉芯褋芯胁, 懈谐薪芯褉懈褉褍褟 芯褋褌邪谢褜薪褘械 锌邪褉邪屑械褌褉褘;
- expired 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 械褋褌褜 褋褌褉芯泻邪 "Expires" 褋芯 蟹薪邪褔械薪懈械屑, 蟹邪锌褉械褖邪褞褖懈屑 泻褝褕懈褉芯胁邪薪懈械;
- no-cache 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 械褋褌褜 褋褌褉芯泻邪 "Cache-Control" 褋 锌邪褉邪屑械褌褉芯屑 "no-cache";
- no-store 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 械褋褌褜 褋褌褉芯泻邪 "Cache-Control" 褋 锌邪褉邪屑械褌褉芯屑 "no-store";
- private 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 械褋褌褜 褋褌褉芯泻邪 "Cache-Control" 褋 锌邪褉邪屑械褌褉芯屑 "private";
- no_last_modified 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 薪械褌 褋褌褉芯泻懈 "Last-Modified";
- no_etag 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 芯褌胁械褌械 薪械褌 褋褌褉芯泻懈 "ETag";
- auth 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械, 械褋谢懈 胁 蟹邪锌褉芯褋械 械褋褌褜 褋褌褉芯泻邪 "Authorization";
- any 鈥 褉邪蟹褉械褕懈褌褜 褋卸邪褌懈械 写谢褟 胁褋械褏 锌褉芯泻褋懈褉芯胁邪薪薪褘褏 蟹邪锌褉芯褋芯胁;
[edit] gzip_types
syntax: gzip_types mime-褌懈锌 [mime-褌懈锌 ...]
default: gzip_types text/html
context: http, server, location
袪邪蟹褉械褕邪械褌 褋卸邪褌懈械 芯褌胁械褌邪 屑械褌芯写芯屑 gzip 写谢褟 褍泻邪蟹邪薪薪褘褏 MIME-褌懈锌芯胁 胁 写芯锌芯谢薪械薪懈械 泻 "text/html". "text/html" 褋卸懈屑邪械褌褋褟 胁褋械谐写邪.