Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_gzip_module.xml @ 330:f94bcab2a6ae
Translated ngx_http_gzip_module and ngx_http_gzip_static_module.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 19 Jan 2012 08:50:12 +0000 |
parents | |
children | a4fa80755eab |
comparison
equal
deleted
inserted
replaced
329:7571ab5b376e | 330:f94bcab2a6ae |
---|---|
1 <?xml version="1.0"?> | |
2 | |
3 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | |
4 | |
5 <module name="Module ngx_http_gzip_module" | |
6 link="/en/docs/http/ngx_http_gzip_module.html" | |
7 lang="en"> | |
8 | |
9 <section id="summary"> | |
10 | |
11 <para> | |
12 The <literal>ngx_http_gzip_module</literal> module is a filter | |
13 that compresses responses using the “gzip” method. | |
14 This often allows to reduce the size of transmitted data by half or even more. | |
15 </para> | |
16 | |
17 </section> | |
18 | |
19 | |
20 <section id="example" name="Example Configuration"> | |
21 | |
22 <para> | |
23 <example> | |
24 gzip on; | |
25 gzip_min_length 1000; | |
26 gzip_proxied expired no-cache no-store private auth; | |
27 gzip_types text/plain application/xml; | |
28 </example> | |
29 </para> | |
30 | |
31 <para> | |
32 The <var>$gzip_ratio</var> variable can be used to log the | |
33 achieved compression ratio. | |
34 </para> | |
35 | |
36 </section> | |
37 | |
38 | |
39 <section id="directives" name="Directives"> | |
40 | |
41 <directive name="gzip"> | |
42 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
43 <default>off</default> | |
44 <context>http</context> | |
45 <context>server</context> | |
46 <context>location</context> | |
47 <context>if in location</context> | |
48 | |
49 <para> | |
50 Enables or disables gzipping of responses. | |
51 </para> | |
52 | |
53 </directive> | |
54 | |
55 | |
56 <directive name="gzip_buffers"> | |
57 <syntax><value>number</value> <value>size</value></syntax> | |
58 <default>32 4k|16 8k</default> | |
59 <context>http</context> | |
60 <context>server</context> | |
61 <context>location</context> | |
62 | |
63 <para> | |
64 Sets the <value>number</value> and <value>size</value> of buffers | |
65 used to compress a response. | |
66 By default, the buffer size is equal to one memory page. | |
67 This is either 4K or 8K, depending on a platform. | |
68 <note> | |
69 Until version 0.7.28, four 4K or 8K buffers were used by default. | |
70 </note> | |
71 </para> | |
72 | |
73 </directive> | |
74 | |
75 | |
76 <directive name="gzip_comp_level"> | |
77 | |
78 <syntax><value>level</value></syntax> | |
79 <default>1</default> | |
80 <context>http</context> | |
81 <context>server</context> | |
82 <context>location</context> | |
83 | |
84 <para> | |
85 Sets a gzip compression <value>level</value> of a response. | |
86 Acceptable values are in the 1..9 range. | |
87 </para> | |
88 | |
89 </directive> | |
90 | |
91 | |
92 <directive name="gzip_disable"> | |
93 <syntax><value>regex</value> ...</syntax> | |
94 <default/> | |
95 <context>http</context> | |
96 <context>server</context> | |
97 <context>location</context> | |
98 <appeared-in>0.6.23</appeared-in> | |
99 | |
100 <para> | |
101 Disables gzipping of responses for requests with | |
102 <header>User-Agent</header> header fields matching | |
103 any of the specified regular expressions. | |
104 </para> | |
105 | |
106 <para> | |
107 The special mask “<literal>msie6</literal>” (0.7.12) corresponds to | |
108 the regular expression “<literal>MSIE [4-6]\.</literal>” but works faster. | |
109 Starting from version 0.8.11, “<literal>MSIE 6.0; ... SV1</literal>” | |
110 is excluded from this mask. | |
111 </para> | |
112 | |
113 </directive> | |
114 | |
115 | |
116 <directive name="gzip_min_length"> | |
117 <syntax><value>length</value></syntax> | |
118 <default>20</default> | |
119 <context>http</context> | |
120 <context>server</context> | |
121 <context>location</context> | |
122 | |
123 <para> | |
124 Sets the minimum length of a response that will be gzipped. | |
125 The length is determined only from the <header>Content-Length</header> | |
126 response header field. | |
127 </para> | |
128 | |
129 </directive> | |
130 | |
131 | |
132 <directive name="gzip_http_version"> | |
133 <syntax><literal>1.0</literal> | <literal>1.1</literal></syntax> | |
134 <default>1.1</default> | |
135 <context>http</context> | |
136 <context>server</context> | |
137 <context>location</context> | |
138 | |
139 <para> | |
140 Sets the minimum HTTP version of a request required to compress a response. | |
141 </para> | |
142 | |
143 </directive> | |
144 | |
145 | |
146 <directive name="gzip_proxied"> | |
147 <syntax> | |
148 <literal>off</literal> | | |
149 <literal>expired</literal> | | |
150 <literal>no-cache</literal> | | |
151 <literal>no-store</literal> | | |
152 <literal>private</literal> | | |
153 <literal>no_last_modified</literal> | | |
154 <literal>no_etag</literal> | | |
155 <literal>auth</literal> | | |
156 <literal>any</literal> | |
157 ...</syntax> | |
158 <default>off</default> | |
159 <context>http</context> | |
160 <context>server</context> | |
161 <context>location</context> | |
162 | |
163 <para> | |
164 Enables or disables gzipping of responses for proxied | |
165 requests depending on the request and response. | |
166 The fact that the response is proxied is determined based on | |
167 the presence of the <header>Via</header> request header field. | |
168 A directive accepts multiple parameters: | |
169 <list type="tag"> | |
170 | |
171 <tag-name><literal>off</literal></tag-name> | |
172 <tag-desc> | |
173 disables compression for all proxied requests, | |
174 ignoring other parameters; | |
175 </tag-desc> | |
176 | |
177 <tag-name><literal>expired</literal></tag-name> | |
178 <tag-desc> | |
179 enables compression if a response header includes the field | |
180 <header>Expires</header> with a value that disables caching; | |
181 </tag-desc> | |
182 | |
183 <tag-name><literal>no-cache</literal></tag-name> | |
184 <tag-desc> | |
185 enables compression if a response header includes the field | |
186 <header>Cache-Control</header> with the parameter “<literal>no-cache</literal>”; | |
187 </tag-desc> | |
188 | |
189 <tag-name><literal>no-store</literal></tag-name> | |
190 <tag-desc> | |
191 enables compression if a response header includes the field | |
192 <header>Cache-Control</header> with the parameter | |
193 “<literal>no-store</literal>”; | |
194 </tag-desc> | |
195 | |
196 <tag-name><literal>private</literal></tag-name> | |
197 <tag-desc> | |
198 enables compression if a response header includes the field | |
199 <header>Cache-Control</header> with the parameter “<literal>private</literal>”; | |
200 </tag-desc> | |
201 | |
202 <tag-name><literal>no_last_modified</literal></tag-name> | |
203 <tag-desc> | |
204 enables compression if a response header does not include the field | |
205 <header>Last-Modified</header>; | |
206 </tag-desc> | |
207 | |
208 <tag-name><literal>no_etag</literal></tag-name> | |
209 <tag-desc> | |
210 enables compression if a response header does not include the field | |
211 <header>ETag</header>; | |
212 </tag-desc> | |
213 | |
214 <tag-name><literal>auth</literal></tag-name> | |
215 <tag-desc> | |
216 enables compression if a request header includes the field | |
217 <header>Authorization</header>; | |
218 </tag-desc> | |
219 | |
220 <tag-name><literal>any</literal></tag-name> | |
221 <tag-desc> | |
222 enables compression for all proxied requests. | |
223 </tag-desc> | |
224 | |
225 </list> | |
226 </para> | |
227 | |
228 </directive> | |
229 | |
230 | |
231 <directive name="gzip_types"> | |
232 <syntax><value>mime-type</value> ...</syntax> | |
233 <default>text/html</default> | |
234 <context>http</context> | |
235 <context>server</context> | |
236 <context>location</context> | |
237 | |
238 <para> | |
239 Enables gzipping of responses for the specified MIME types in addition | |
240 to “<literal>text/html</literal>”. | |
241 Responses with the type “<literal>text/html</literal>” are always compressed. | |
242 </para> | |
243 | |
244 </directive> | |
245 | |
246 | |
247 <directive name="gzip_vary"> | |
248 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
249 <default>off</default> | |
250 <context>http</context> | |
251 <context>server</context> | |
252 <context>location</context> | |
253 | |
254 <para> | |
255 Enables or disables emitting the <header>Vary: Accept-Encoding</header> | |
256 response header field if the directives | |
257 <link id="gzip"/> or | |
258 <link doc="ngx_http_gzip_static_module.xml" id="gzip_static"/> | |
259 are active. | |
260 </para> | |
261 | |
262 </directive> | |
263 | |
264 </section> | |
265 | |
266 </module> |