Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_scgi_module.xml @ 1382:94cac978bda3
Documented variables support in proxy_cache and look-alikes.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 23 Dec 2014 11:35:33 +0300 |
parents | 91f5c089f4ca |
children | 66ee77849563 |
rev | line source |
---|---|
1180 | 1 <?xml version="1.0"?> |
2 | |
3 <!-- | |
4 Copyright (C) Igor Sysoev | |
5 Copyright (C) Nginx, Inc. | |
6 --> | |
7 | |
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | |
9 | |
10 <module name="Module ngx_http_scgi_module" | |
11 link="/en/docs/http/ngx_http_scgi_module.html" | |
12 lang="en" | |
1382
94cac978bda3
Documented variables support in proxy_cache and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1379
diff
changeset
|
13 rev="14"> |
1180 | 14 |
15 <section id="summary"> | |
16 | |
17 <para> | |
18 The <literal>ngx_http_scgi_module</literal> module allows passing | |
19 requests to an SCGI server. | |
20 </para> | |
21 | |
22 </section> | |
23 | |
24 | |
25 <section id="example" name="Example Configuration"> | |
26 | |
27 <para> | |
28 <example> | |
29 location / { | |
30 include scgi_params; | |
31 scgi_pass localhost:9000; | |
32 } | |
33 </example> | |
34 </para> | |
35 | |
36 </section> | |
37 | |
38 | |
39 <section id="directives" name="Directives"> | |
40 | |
41 <directive name="scgi_bind"> | |
42 <syntax><value>address</value> | <literal>off</literal></syntax> | |
43 <default/> | |
44 <context>http</context> | |
45 <context>server</context> | |
46 <context>location</context> | |
47 | |
48 <para> | |
49 Makes outgoing connections to an SCGI server originate | |
50 from the specified local IP <value>address</value>. | |
51 Parameter value can contain variables (1.3.12). | |
52 The special value <literal>off</literal> (1.3.12) cancels the effect | |
53 of the <literal>scgi_bind</literal> directive | |
54 inherited from the previous configuration level, which allows the | |
55 system to auto-assign the local IP address. | |
56 </para> | |
57 | |
58 </directive> | |
59 | |
60 | |
61 <directive name="scgi_buffer_size"> | |
62 <syntax><value>size</value></syntax> | |
63 <default>4k|8k</default> | |
64 <context>http</context> | |
65 <context>server</context> | |
66 <context>location</context> | |
67 | |
68 <para> | |
69 Sets the <value>size</value> of the buffer used for reading the first part | |
70 of the response received from the SCGI server. | |
71 This part usually contains a small response header. | |
72 By default, the buffer size is equal to the size of one | |
73 buffer set by the <link id="scgi_buffers"/> directive. | |
74 It can be made smaller, however. | |
75 </para> | |
76 | |
77 </directive> | |
78 | |
79 | |
80 <directive name="scgi_buffering"> | |
81 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
82 <default>on</default> | |
83 <context>http</context> | |
84 <context>server</context> | |
85 <context>location</context> | |
86 | |
87 <para> | |
88 Enables or disables buffering of responses from the SCGI server. | |
89 </para> | |
90 | |
91 <para> | |
92 When buffering is enabled, nginx receives a response from the SCGI server | |
93 as soon as possible, saving it into the buffers set by the | |
94 <link id="scgi_buffer_size"/> and <link id="scgi_buffers"/> directives. | |
95 If the whole response does not fit into memory, a part of it can be saved | |
96 to a <link id="scgi_temp_path">temporary file</link> on the disk. | |
97 Writing to temporary files is controlled by the | |
98 <link id="scgi_max_temp_file_size"/> and | |
99 <link id="scgi_temp_file_write_size"/> directives. | |
100 </para> | |
101 | |
102 <para> | |
103 When buffering is disabled, the response is passed to a client synchronously, | |
104 immediately as it is received. | |
105 nginx will not try to read the whole response from the SCGI server. | |
106 The maximum size of the data that nginx can receive from the server | |
107 at a time is set by the <link id="scgi_buffer_size"/> directive. | |
108 </para> | |
109 | |
110 <para> | |
111 Buffering can also be enabled or disabled by passing | |
112 “<literal>yes</literal>” or “<literal>no</literal>” in the | |
113 <header>X-Accel-Buffering</header> response header field. | |
114 This capability can be disabled using the | |
115 <link id="scgi_ignore_headers"/> directive. | |
116 </para> | |
117 | |
118 </directive> | |
119 | |
120 | |
121 <directive name="scgi_buffers"> | |
122 <syntax><value>number</value> <value>size</value></syntax> | |
123 <default>8 4k|8k</default> | |
124 <context>http</context> | |
125 <context>server</context> | |
126 <context>location</context> | |
127 | |
128 <para> | |
129 Sets the <value>number</value> and <value>size</value> of the | |
130 buffers used for reading a response from the SCGI server, | |
131 for a single connection. | |
132 By default, the buffer size is equal to one memory page. | |
133 This is either 4K or 8K, depending on a platform. | |
134 </para> | |
135 | |
136 </directive> | |
137 | |
138 | |
139 <directive name="scgi_busy_buffers_size"> | |
140 <syntax><value>size</value></syntax> | |
141 <default>8k|16k</default> | |
142 <context>http</context> | |
143 <context>server</context> | |
144 <context>location</context> | |
145 | |
146 <para> | |
147 When <link id="scgi_buffering">buffering</link> of responses from the SCGI | |
148 server is enabled, limits the total <value>size</value> of buffers that | |
149 can be busy sending a response to the client while the response is not | |
150 yet fully read. | |
151 In the meantime, the rest of the buffers can be used for reading the response | |
152 and, if needed, buffering part of the response to a temporary file. | |
153 By default, <value>size</value> is limited by the size of two buffers set by the | |
154 <link id="scgi_buffer_size"/> and <link id="scgi_buffers"/> directives. | |
155 </para> | |
156 | |
157 </directive> | |
158 | |
159 | |
160 <directive name="scgi_cache"> | |
161 <syntax><value>zone</value> | <literal>off</literal></syntax> | |
162 <default>off</default> | |
163 <context>http</context> | |
164 <context>server</context> | |
165 <context>location</context> | |
166 | |
167 <para> | |
168 Defines a shared memory zone used for caching. | |
169 The same zone can be used in several places. | |
1382
94cac978bda3
Documented variables support in proxy_cache and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1379
diff
changeset
|
170 Parameter value can contain variables (1.7.9). |
1180 | 171 The <literal>off</literal> parameter disables caching inherited |
172 from the previous configuration level. | |
173 </para> | |
174 | |
175 </directive> | |
176 | |
177 | |
178 <directive name="scgi_cache_bypass"> | |
179 <syntax><value>string</value> ...</syntax> | |
180 <default/> | |
181 <context>http</context> | |
182 <context>server</context> | |
183 <context>location</context> | |
184 | |
185 <para> | |
186 Defines conditions under which the response will not be taken from a cache. | |
187 If at least one value of the string parameters is not empty and is not | |
188 equal to “0” then the response will not be taken from the cache: | |
189 <example> | |
190 scgi_cache_bypass $cookie_nocache $arg_nocache$arg_comment; | |
191 scgi_cache_bypass $http_pragma $http_authorization; | |
192 </example> | |
193 Can be used along with the <link id="scgi_no_cache"/> directive. | |
194 </para> | |
195 | |
196 </directive> | |
197 | |
198 | |
199 <directive name="scgi_cache_key"> | |
200 <syntax><value>string</value></syntax> | |
201 <default/> | |
202 <context>http</context> | |
203 <context>server</context> | |
204 <context>location</context> | |
205 | |
206 <para> | |
207 Defines a key for caching, for example | |
208 <example> | |
209 scgi_cache_key localhost:9000$request_uri; | |
210 </example> | |
211 </para> | |
212 | |
213 </directive> | |
214 | |
215 | |
216 <directive name="scgi_cache_lock"> | |
217 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
218 <default>off</default> | |
219 <context>http</context> | |
220 <context>server</context> | |
221 <context>location</context> | |
222 <appeared-in>1.1.12</appeared-in> | |
223 | |
224 <para> | |
225 When enabled, only one request at a time will be allowed to populate | |
226 a new cache element identified according to the <link id="scgi_cache_key"/> | |
227 directive by passing a request to an SCGI server. | |
228 Other requests of the same cache element will either wait | |
229 for a response to appear in the cache or the cache lock for | |
230 this element to be released, up to the time set by the | |
231 <link id="scgi_cache_lock_timeout"/> directive. | |
232 </para> | |
233 | |
234 </directive> | |
235 | |
236 | |
1379
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
237 <directive name="scgi_cache_lock_age"> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
238 <syntax><value>time</value></syntax> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
239 <default>5s</default> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
240 <context>http</context> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
241 <context>server</context> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
242 <context>location</context> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
243 <appeared-in>1.7.8</appeared-in> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
244 |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
245 <para> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
246 If the last request passed to the SCGI server |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
247 for populating a new cache element |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
248 has not completed for the specified <value>time</value>, |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
249 one more request may be passed to the SCGI server. |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
250 </para> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
251 |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
252 </directive> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
253 |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
254 |
1180 | 255 <directive name="scgi_cache_lock_timeout"> |
256 <syntax><value>time</value></syntax> | |
257 <default>5s</default> | |
258 <context>http</context> | |
259 <context>server</context> | |
260 <context>location</context> | |
261 <appeared-in>1.1.12</appeared-in> | |
262 | |
263 <para> | |
264 Sets a timeout for <link id="scgi_cache_lock"/>. | |
1379
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
265 When the <value>time</value> expires, |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
266 the request will be passed to the SCGI server, |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
267 however, the response will not be cached. |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
268 <note> |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
269 Before 1.7.8, the response could be cached. |
91f5c089f4ca
Documented fastcgi_cache_lock_age and look-alikes.
Ruslan Ermilov <ru@nginx.com>
parents:
1353
diff
changeset
|
270 </note> |
1180 | 271 </para> |
272 | |
273 </directive> | |
274 | |
275 | |
276 <directive name="scgi_cache_methods"> | |
277 <syntax> | |
278 <literal>GET</literal> | | |
279 <literal>HEAD</literal> | | |
280 <literal>POST</literal> | |
281 ...</syntax> | |
282 <default>GET HEAD</default> | |
283 <context>http</context> | |
284 <context>server</context> | |
285 <context>location</context> | |
286 | |
287 <para> | |
288 If the client request method is listed in this directive then | |
289 the response will be cached. | |
290 “<literal>GET</literal>” and “<literal>HEAD</literal>” methods are always | |
291 added to the list, though it is recommended to specify them explicitly. | |
292 See also the <link id="scgi_no_cache"/> directive. | |
293 </para> | |
294 | |
295 </directive> | |
296 | |
297 | |
298 <directive name="scgi_cache_min_uses"> | |
299 <syntax><value>number</value></syntax> | |
300 <default>1</default> | |
301 <context>http</context> | |
302 <context>server</context> | |
303 <context>location</context> | |
304 | |
305 <para> | |
306 Sets the <value>number</value> of requests after which the response | |
307 will be cached. | |
308 </para> | |
309 | |
310 </directive> | |
311 | |
312 | |
313 <directive name="scgi_cache_path"> | |
314 <syntax> | |
315 <value>path</value> | |
316 [<literal>levels</literal>=<value>levels</value>] | |
317 <literal>keys_zone</literal>=<value>name</value>:<value>size</value> | |
318 [<literal>inactive</literal>=<value>time</value>] | |
319 [<literal>max_size</literal>=<value>size</value>] | |
320 [<literal>loader_files</literal>=<value>number</value>] | |
321 [<literal>loader_sleep</literal>=<value>time</value>] | |
322 [<literal>loader_threshold</literal>=<value>time</value>]</syntax> | |
323 <default/> | |
324 <context>http</context> | |
325 | |
326 <para> | |
327 Sets the path and other parameters of a cache. | |
328 Cache data are stored in files. | |
1190
dd4cfc6ce770
Corrected description of *_cache_path file names.
Ruslan Ermilov <ru@nginx.com>
parents:
1189
diff
changeset
|
329 The file name in a cache is a result of |
dd4cfc6ce770
Corrected description of *_cache_path file names.
Ruslan Ermilov <ru@nginx.com>
parents:
1189
diff
changeset
|
330 applying the MD5 function to the |
dd4cfc6ce770
Corrected description of *_cache_path file names.
Ruslan Ermilov <ru@nginx.com>
parents:
1189
diff
changeset
|
331 <link id="scgi_cache_key">cache key</link>. |
1180 | 332 The <literal>levels</literal> parameter defines hierarchy levels of a cache. |
333 For example, in the following configuration | |
334 <example> | |
335 scgi_cache_path /data/nginx/cache levels=1:2 keys_zone=one:10m; | |
336 </example> | |
337 file names in a cache will look like this: | |
338 <example> | |
339 /data/nginx/cache/<emphasis>c</emphasis>/<emphasis>29</emphasis>/b7f54b2df7773722d382f4809d650<emphasis>29c</emphasis> | |
340 </example> | |
341 </para> | |
342 | |
343 <para> | |
344 A cached response is first written to a temporary file, | |
345 and then the file is renamed. | |
346 Starting from version 0.8.9, temporary files and the cache can be put on | |
347 different file systems. | |
348 However, be aware that in this case a file is copied | |
349 across two file systems instead of the cheap renaming operation. | |
350 It is thus recommended that for any given location both cache and a directory | |
351 holding temporary files, set by the <link id="scgi_temp_path"/> directive, | |
352 are put on the same file system. | |
353 </para> | |
354 | |
355 <para> | |
356 In addition, all active keys and information about data are stored | |
357 in a shared memory zone, whose <value>name</value> and <value>size</value> | |
358 are configured by the <literal>keys_zone</literal> parameter. | |
1189
f25d00109de0
Documented cache keys_zone memory estimates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1185
diff
changeset
|
359 One megabyte zone can store about 8 thousand keys. |
f25d00109de0
Documented cache keys_zone memory estimates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1185
diff
changeset
|
360 </para> |
f25d00109de0
Documented cache keys_zone memory estimates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1185
diff
changeset
|
361 |
f25d00109de0
Documented cache keys_zone memory estimates.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1185
diff
changeset
|
362 <para> |
1180 | 363 Cached data that are not accessed during the time specified by the |
364 <literal>inactive</literal> parameter get removed from the cache | |
365 regardless of their freshness. | |
366 By default, <literal>inactive</literal> is set to 10 minutes. | |
367 </para> | |
368 | |
369 <para> | |
370 The special “cache manager” process monitors the maximum cache size set | |
371 by the <literal>max_size</literal> parameter. | |
372 When this size is exceeded, it removes the least recently used data. | |
373 </para> | |
374 | |
375 <para> | |
376 A minute after the start the special “cache loader” process is activated. | |
377 It loads information about previously cached data stored on file system | |
378 into a cache zone. | |
379 The loading is done in iterations. | |
380 During one iteration no more than <literal>loader_files</literal> items | |
381 are loaded (by default, 100). | |
382 Besides, the duration of one iteration is limited by the | |
383 <literal>loader_threshold</literal> parameter (by default, 200 milliseconds). | |
384 Between iterations, a pause configured by the <literal>loader_sleep</literal> | |
385 parameter (by default, 50 milliseconds) is made. | |
386 </para> | |
387 | |
388 </directive> | |
389 | |
390 | |
391 <directive name="scgi_cache_purge"> | |
392 <syntax>string ...</syntax> | |
393 <default/> | |
394 <context>http</context> | |
395 <context>server</context> | |
396 <context>location</context> | |
397 <appeared-in>1.5.7</appeared-in> | |
398 | |
399 <para> | |
400 Defines conditions under which the request will be considered a cache | |
401 purge request. | |
402 If at least one value of the string parameters is not empty and is not equal | |
403 to “0” then the cache entry with a corresponding | |
404 <link id="scgi_cache_key">cache key</link> is removed. | |
405 The result of successful operation is indicated by returning | |
406 the <http-status code="204" text="No Content"/> response. | |
407 </para> | |
408 | |
409 <para> | |
410 If the <link id="scgi_cache_key">cache key</link> of a purge request ends | |
411 with an asterisk (“<literal>*</literal>”), all cache entries matching the | |
412 wildcard key will be removed from the cache. | |
413 </para> | |
414 | |
415 <para> | |
416 Example configuration: | |
417 <example> | |
418 scgi_cache_path /data/nginx/cache keys_zone=cache_zone:10m; | |
419 | |
420 map $request_method $purge_method { | |
421 PURGE 1; | |
422 default 0; | |
423 } | |
424 | |
425 server { | |
426 ... | |
427 location / { | |
1185
f9c8336fe43c
Aligned configuration examples with fastcgi/scgi_cache_purge.
Ruslan Ermilov <ru@nginx.com>
parents:
1184
diff
changeset
|
428 scgi_pass backend; |
f9c8336fe43c
Aligned configuration examples with fastcgi/scgi_cache_purge.
Ruslan Ermilov <ru@nginx.com>
parents:
1184
diff
changeset
|
429 scgi_cache cache_zone; |
f9c8336fe43c
Aligned configuration examples with fastcgi/scgi_cache_purge.
Ruslan Ermilov <ru@nginx.com>
parents:
1184
diff
changeset
|
430 scgi_cache_key $uri; |
1180 | 431 scgi_cache_purge $purge_method; |
432 } | |
433 } | |
434 </example> | |
435 <note> | |
436 This functionality is available as part of our | |
437 <commercial_version>commercial subscription</commercial_version>. | |
438 </note> | |
439 </para> | |
440 | |
441 </directive> | |
442 | |
443 | |
444 <directive name="scgi_cache_revalidate"> | |
445 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
446 <default>off</default> | |
447 <context>http</context> | |
448 <context>server</context> | |
449 <context>location</context> | |
450 <appeared-in>1.5.7</appeared-in> | |
451 | |
452 <para> | |
453 Enables revalidation of expired cache items using conditional requests with | |
1246
5be7716a5684
Documented If-None-Match in proxy_cache_revalidate and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1190
diff
changeset
|
454 the <header>If-Modified-Since</header> and <header>If-None-Match</header> |
5be7716a5684
Documented If-None-Match in proxy_cache_revalidate and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1190
diff
changeset
|
455 header fields. |
1180 | 456 </para> |
457 | |
458 </directive> | |
459 | |
460 | |
461 <directive name="scgi_cache_use_stale"> | |
462 <syntax> | |
463 <literal>error</literal> | | |
464 <literal>timeout</literal> | | |
465 <literal>invalid_header</literal> | | |
466 <literal>updating</literal> | | |
467 <literal>http_500</literal> | | |
468 <literal>http_503</literal> | | |
469 <literal>http_403</literal> | | |
470 <literal>http_404</literal> | | |
471 <literal>off</literal> | |
472 ...</syntax> | |
473 <default>off</default> | |
474 <context>http</context> | |
475 <context>server</context> | |
476 <context>location</context> | |
477 | |
478 <para> | |
479 Determines in which cases a stale cached response can be used | |
480 when an error occurs during communication with the SCGI server. | |
481 The directive’s parameters match the parameters of the | |
482 <link id="scgi_next_upstream"/> directive. | |
483 </para> | |
484 | |
485 <para> | |
486 Additionally, the <literal>updating</literal> parameter permits | |
487 using a stale cached response if it is currently being updated. | |
488 This allows minimizing the number of accesses to SCGI servers | |
489 when updating cached data. | |
490 </para> | |
491 | |
492 <para> | |
493 To minimize the number of accesses to SCGI servers when | |
494 populating a new cache element, the <link id="scgi_cache_lock"/> | |
495 directive can be used. | |
496 </para> | |
497 | |
498 </directive> | |
499 | |
500 | |
501 <directive name="scgi_cache_valid"> | |
502 <syntax>[<value>code</value> ...] <value>time</value></syntax> | |
503 <default/> | |
504 <context>http</context> | |
505 <context>server</context> | |
506 <context>location</context> | |
507 | |
508 <para> | |
509 Sets caching time for different response codes. | |
510 For example, the following directives | |
511 <example> | |
512 scgi_cache_valid 200 302 10m; | |
513 scgi_cache_valid 404 1m; | |
514 </example> | |
515 set 10 minutes of caching for responses with codes 200 and 302 | |
516 and 1 minute for responses with code 404. | |
517 </para> | |
518 | |
519 <para> | |
520 If only caching <value>time</value> is specified | |
521 <example> | |
522 scgi_cache_valid 5m; | |
523 </example> | |
524 then only 200, 301, and 302 responses are cached. | |
525 </para> | |
526 | |
527 <para> | |
528 In addition, the <literal>any</literal> parameter can be specified | |
529 to cache any responses: | |
530 <example> | |
531 scgi_cache_valid 200 302 10m; | |
532 scgi_cache_valid 301 1h; | |
533 scgi_cache_valid any 1m; | |
534 </example> | |
535 </para> | |
536 | |
537 <para> | |
538 Parameters of caching can also be set directly | |
539 in the response header. | |
540 This has higher priority than setting of caching time using the directive. | |
1349
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
541 <list type="bullet" compact="no"> |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
542 |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
543 <listitem> |
1180 | 544 The <header>X-Accel-Expires</header> header field sets caching time of a |
545 response in seconds. | |
546 The zero value disables caching for a response. | |
547 If the value starts with the <literal>@</literal> prefix, it sets an absolute | |
548 time in seconds since Epoch, up to which the response may be cached. | |
1349
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
549 </listitem> |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
550 |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
551 <listitem> |
1180 | 552 If the header does not include the <header>X-Accel-Expires</header> field, |
553 parameters of caching may be set in the header fields | |
554 <header>Expires</header> or <header>Cache-Control</header>. | |
1349
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
555 </listitem> |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
556 |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
557 <listitem> |
1180 | 558 If the header includes the <header>Set-Cookie</header> field, such a |
559 response will not be cached. | |
1349
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
560 </listitem> |
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
561 |
1353
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
562 <listitem> |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
563 If the header includes the <header>Vary</header> field |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
564 with the special value “<literal>*</literal>”, such a |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
565 response will not be cached (1.7.7). |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
566 If the header includes the <header>Vary</header> field |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
567 with another value, such a response will be cached |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
568 taking into account the corresponding request header fields (1.7.7). |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
569 </listitem> |
25db29c8875e
Documented how the "Vary" response header field affects caching.
Ruslan Ermilov <ru@nginx.com>
parents:
1352
diff
changeset
|
570 |
1349
97c8b146cb0e
Split the long paragraph about caching parameters into the list.
Ruslan Ermilov <ru@nginx.com>
parents:
1345
diff
changeset
|
571 </list> |
1180 | 572 Processing of one or more of these response header fields can be disabled |
573 using the <link id="scgi_ignore_headers"/> directive. | |
574 </para> | |
575 | |
576 </directive> | |
577 | |
578 | |
579 <directive name="scgi_connect_timeout"> | |
580 <syntax><value>time</value></syntax> | |
581 <default>60s</default> | |
582 <context>http</context> | |
583 <context>server</context> | |
584 <context>location</context> | |
585 | |
586 <para> | |
587 Defines a timeout for establishing a connection with an SCGI server. | |
588 It should be noted that this timeout cannot usually exceed 75 seconds. | |
589 </para> | |
590 | |
591 </directive> | |
592 | |
593 | |
1337
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
594 <directive name="scgi_force_ranges"> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
595 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
596 <default>off</default> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
597 <context>http</context> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
598 <context>server</context> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
599 <context>location</context> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
600 <appeared-in>1.7.7</appeared-in> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
601 |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
602 <para> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
603 Enables byte-range support |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
604 for both cached and uncached responses from the SCGI server |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
605 regardless of the <header>Accept-Ranges</header> field in these responses. |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
606 </para> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
607 |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
608 </directive> |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
609 |
91a064bdb4f9
Documented the "proxy_force_ranges" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1290
diff
changeset
|
610 |
1180 | 611 <directive name="scgi_hide_header"> |
612 <syntax><value>field</value></syntax> | |
613 <default/> | |
614 <context>http</context> | |
615 <context>server</context> | |
616 <context>location</context> | |
617 | |
618 <para> | |
619 By default, | |
620 nginx does not pass the header fields <header>Status</header> and | |
621 <header>X-Accel-...</header> from the response of an SCGI | |
622 server to a client. | |
623 The <literal>scgi_hide_header</literal> directive sets additional fields | |
624 that will not be passed. | |
625 If, on the contrary, the passing of fields needs to be permitted, | |
626 the <link id="scgi_pass_header"/> directive can be used. | |
627 </para> | |
628 | |
629 </directive> | |
630 | |
631 | |
632 <directive name="scgi_ignore_client_abort"> | |
633 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
634 <default>off</default> | |
635 <context>http</context> | |
636 <context>server</context> | |
637 <context>location</context> | |
638 | |
639 <para> | |
640 Determines whether the connection with an SCGI server should be | |
641 closed when a client closes the connection without waiting | |
642 for a response. | |
643 </para> | |
644 | |
645 </directive> | |
646 | |
647 | |
648 <directive name="scgi_ignore_headers"> | |
649 <syntax><value>field</value> ...</syntax> | |
650 <default/> | |
651 <context>http</context> | |
652 <context>server</context> | |
653 <context>location</context> | |
654 | |
655 <para> | |
656 Disables processing of certain response header fields from the SCGI server. | |
657 The following fields can be ignored: <header>X-Accel-Redirect</header>, | |
658 <header>X-Accel-Expires</header>, <header>X-Accel-Limit-Rate</header> (1.1.6), | |
659 <header>X-Accel-Buffering</header> (1.1.6), | |
660 <header>X-Accel-Charset</header> (1.1.6), <header>Expires</header>, | |
1345
da296387cdac
Documented the Vary support in proxy_ignore_headers and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1343
diff
changeset
|
661 <header>Cache-Control</header>, <header>Set-Cookie</header> (0.8.44), |
da296387cdac
Documented the Vary support in proxy_ignore_headers and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1343
diff
changeset
|
662 and <header>Vary</header> (1.7.7). |
1180 | 663 </para> |
664 | |
665 <para> | |
666 If not disabled, processing of these header fields has the following | |
667 effect: | |
668 <list type="bullet" compact="no"> | |
669 | |
670 <listitem> | |
671 <header>X-Accel-Expires</header>, <header>Expires</header>, | |
1345
da296387cdac
Documented the Vary support in proxy_ignore_headers and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1343
diff
changeset
|
672 <header>Cache-Control</header>, <header>Set-Cookie</header>, |
da296387cdac
Documented the Vary support in proxy_ignore_headers and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1343
diff
changeset
|
673 and <header>Vary</header> |
1180 | 674 set the parameters of response <link id="scgi_cache_valid">caching</link>; |
675 </listitem> | |
676 | |
677 <listitem> | |
678 <header>X-Accel-Redirect</header> performs an | |
679 <link doc="ngx_http_core_module.xml" id="internal">internal | |
680 redirect</link> to the specified URI; | |
681 </listitem> | |
682 | |
683 <listitem> | |
684 <header>X-Accel-Limit-Rate</header> sets the | |
685 <link doc="ngx_http_core_module.xml" id="limit_rate">rate | |
686 limit</link> for transmission of a response to a client; | |
687 </listitem> | |
688 | |
689 <listitem> | |
690 <header>X-Accel-Buffering</header> enables or disables | |
691 <link id="scgi_buffering">buffering</link> of a response; | |
692 </listitem> | |
693 | |
694 <listitem> | |
695 <header>X-Accel-Charset</header> sets the desired | |
696 <link doc="ngx_http_charset_module.xml" id="charset"/> | |
697 of a response. | |
698 </listitem> | |
699 | |
700 </list> | |
701 </para> | |
702 | |
703 </directive> | |
704 | |
705 | |
706 <directive name="scgi_intercept_errors"> | |
707 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
708 <default>off</default> | |
709 <context>http</context> | |
710 <context>server</context> | |
711 <context>location</context> | |
712 | |
713 <para> | |
714 Determines whether an SCGI server responses with codes greater than or equal | |
715 to 300 should be passed to a client or be redirected to nginx for processing | |
716 with the <link doc="ngx_http_core_module.xml" id="error_page"/> directive. | |
717 </para> | |
718 | |
719 </directive> | |
720 | |
721 | |
1342
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
722 <directive name="scgi_limit_rate"> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
723 <syntax><value>rate</value></syntax> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
724 <default>0</default> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
725 <context>http</context> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
726 <context>server</context> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
727 <context>location</context> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
728 <appeared-in>1.7.7</appeared-in> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
729 |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
730 <para> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
731 Limits the speed of reading the response from the SCGI server. |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
732 The <value>rate</value> is specified in bytes per second. |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
733 The zero value disables rate limiting. |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
734 The limit is set per a request, and so if nginx simultaneously opens |
1343
1bdde28e359b
Fixed fallouts from the previous change.
Ruslan Ermilov <ru@nginx.com>
parents:
1342
diff
changeset
|
735 two connections to the SCGI server, |
1bdde28e359b
Fixed fallouts from the previous change.
Ruslan Ermilov <ru@nginx.com>
parents:
1342
diff
changeset
|
736 the overall rate will be twice as much as the specified limit. |
1342
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
737 The limitation works only if |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
738 <link id="scgi_buffering">buffering</link> of responses from the SCGI |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
739 server is enabled. |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
740 </para> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
741 |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
742 </directive> |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
743 |
758fc0b02651
Documented the "proxy_limit_rate" directive and friends.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1337
diff
changeset
|
744 |
1180 | 745 <directive name="scgi_max_temp_file_size"> |
746 <syntax><value>size</value></syntax> | |
747 <default>1024m</default> | |
748 <context>http</context> | |
749 <context>server</context> | |
750 <context>location</context> | |
751 | |
752 <para> | |
753 When <link id="scgi_buffering">buffering</link> of responses from the SCGI | |
754 server is enabled, and the whole response does not fit into the buffers | |
755 set by the <link id="scgi_buffer_size"/> and <link id="scgi_buffers"/> | |
756 directives, a part of the response can be saved to a temporary file. | |
757 This directive sets the maximum <value>size</value> of the temporary file. | |
758 The size of data written to the temporary file at a time is set | |
759 by the <link id="scgi_temp_file_write_size"/> directive. | |
760 </para> | |
761 | |
762 <para> | |
763 The zero value disables buffering of responses to temporary files. | |
764 </para> | |
765 | |
1352
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
766 <para> |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
767 <note> |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
768 This restriction does not apply to responses |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
769 that will be <link id="scgi_cache">cached</link> |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
770 or <link id="scgi_store">stored</link> on disk. |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
771 </note> |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
772 </para> |
dbb618f60a54
Elaborate on writing proxied responses to files.
Ruslan Ermilov <ru@nginx.com>
parents:
1349
diff
changeset
|
773 |
1180 | 774 </directive> |
775 | |
776 | |
777 <directive name="scgi_next_upstream"> | |
778 <syntax> | |
779 <literal>error</literal> | | |
780 <literal>timeout</literal> | | |
781 <literal>invalid_header</literal> | | |
782 <literal>http_500</literal> | | |
783 <literal>http_503</literal> | | |
784 <literal>http_403</literal> | | |
785 <literal>http_404</literal> | | |
786 <literal>off</literal> | |
787 ...</syntax> | |
788 <default>error timeout</default> | |
789 <context>http</context> | |
790 <context>server</context> | |
791 <context>location</context> | |
792 | |
793 <para> | |
794 Specifies in which cases a request should be passed to the next server: | |
795 <list type="tag"> | |
796 | |
797 <tag-name><literal>error</literal></tag-name> | |
798 <tag-desc>an error occurred while establishing a connection with the | |
799 server, passing a request to it, or reading the response header;</tag-desc> | |
800 | |
801 <tag-name><literal>timeout</literal></tag-name> | |
802 <tag-desc>a timeout has occurred while establishing a connection with the | |
803 server, passing a request to it, or reading the response header;</tag-desc> | |
804 | |
805 <tag-name><literal>invalid_header</literal></tag-name> | |
806 <tag-desc>a server returned an empty or invalid response;</tag-desc> | |
807 | |
808 <tag-name><literal>http_500</literal></tag-name> | |
809 <tag-desc>a server returned a response with the code 500;</tag-desc> | |
810 | |
811 <tag-name><literal>http_503</literal></tag-name> | |
812 <tag-desc>a server returned a response with the code 503;</tag-desc> | |
813 | |
814 <tag-name><literal>http_403</literal></tag-name> | |
815 <tag-desc>a server returned a response with the code 403;</tag-desc> | |
816 | |
817 <tag-name><literal>http_404</literal></tag-name> | |
818 <tag-desc>a server returned a response with the code 404;</tag-desc> | |
819 | |
820 <tag-name><literal>off</literal></tag-name> | |
821 <tag-desc>disables passing a request to the next server.</tag-desc> | |
822 | |
823 </list> | |
824 </para> | |
825 | |
826 <para> | |
827 One should bear in mind that passing a request to the next server is | |
828 only possible if nothing has been sent to a client yet. | |
829 That is, if an error or timeout occurs in the middle of the | |
830 transferring of a response, fixing this is impossible. | |
831 </para> | |
832 | |
833 <para> | |
1289
57fc39924d42
Proxy/memcached/fastcgi/scgi/uwsgi: updated link in _next_upstream directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1246
diff
changeset
|
834 The directive also defines what is considered an |
57fc39924d42
Proxy/memcached/fastcgi/scgi/uwsgi: updated link in _next_upstream directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1246
diff
changeset
|
835 <link doc="ngx_http_upstream_module.xml" id="max_fails">unsuccessful |
57fc39924d42
Proxy/memcached/fastcgi/scgi/uwsgi: updated link in _next_upstream directives.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1246
diff
changeset
|
836 attempt</link> of communication with a server. |
1180 | 837 The cases of <literal>error</literal>, <literal>timeout</literal> and |
838 <literal>invalid_header</literal> are always considered unsuccessful attempts, | |
839 even if they are not specified in the directive. | |
840 The cases of <literal>http_500</literal> and <literal>http_503</literal> are | |
841 considered unsuccessful attempts only if they are specified in the directive. | |
842 The cases of <literal>http_403</literal> and <literal>http_404</literal> | |
843 are never considered unsuccessful attempts. | |
844 </para> | |
845 | |
1290
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
846 <para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
847 Passing a request to the next server can be limited by |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
848 <link id="scgi_next_upstream_tries">the number of tries</link> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
849 and by <link id="scgi_next_upstream_timeout">time</link>. |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
850 </para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
851 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
852 </directive> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
853 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
854 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
855 <directive name="scgi_next_upstream_timeout"> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
856 <syntax><value>time</value></syntax> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
857 <default>0</default> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
858 <context>http</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
859 <context>server</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
860 <context>location</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
861 <appeared-in>1.7.5</appeared-in> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
862 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
863 <para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
864 Limits the time allowed to pass a request to the |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
865 <link id="scgi_next_upstream">next server</link>. |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
866 The <literal>0</literal> value turns off this limitation. |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
867 </para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
868 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
869 </directive> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
870 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
871 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
872 <directive name="scgi_next_upstream_tries"> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
873 <syntax><value>number</value></syntax> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
874 <default>0</default> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
875 <context>http</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
876 <context>server</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
877 <context>location</context> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
878 <appeared-in>1.7.5</appeared-in> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
879 |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
880 <para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
881 Limits the number of possible tries for passing a request to the |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
882 <link id="scgi_next_upstream">next server</link>. |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
883 The <literal>0</literal> value turns off this limitation. |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
884 </para> |
f5cc9f2aef9a
Proxy/memcached/fastcgi/scgi/uwsgi: _next_upstream_timeout,_next_upstream_tries.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1289
diff
changeset
|
885 |
1180 | 886 </directive> |
887 | |
888 | |
889 <directive name="scgi_no_cache"> | |
890 <syntax><value>string</value> ...</syntax> | |
891 <default/> | |
892 <context>http</context> | |
893 <context>server</context> | |
894 <context>location</context> | |
895 | |
896 <para> | |
897 Defines conditions under which the response will not be saved to a cache. | |
898 If at least one value of the string parameters is not empty and is not | |
899 equal to “0” then the response will not be saved: | |
900 <example> | |
901 scgi_no_cache $cookie_nocache $arg_nocache$arg_comment; | |
902 scgi_no_cache $http_pragma $http_authorization; | |
903 </example> | |
904 Can be used along with the <link id="scgi_cache_bypass"/> directive. | |
905 </para> | |
906 | |
907 </directive> | |
908 | |
909 | |
910 <directive name="scgi_param"> | |
911 <syntax> | |
912 <value>parameter</value> <value>value</value> | |
913 [<literal>if_not_empty</literal>]</syntax> | |
914 <default/> | |
915 <context>http</context> | |
916 <context>server</context> | |
917 <context>location</context> | |
918 | |
919 <para> | |
920 Sets a <value>parameter</value> that should be passed to the SCGI server. | |
921 The <value>value</value> can contain text, variables, and their combination. | |
922 These directives are inherited from the previous level if and | |
923 only if there are no | |
924 <literal>scgi_param</literal> | |
925 directives defined on the current level. | |
926 </para> | |
927 | |
928 <para> | |
929 Standard | |
930 <link url="http://tools.ietf.org/html/rfc3875#section-4.1">CGI | |
931 environment variables</link> | |
932 should be provided as SCGI headers, see the <path>scgi_params</path> file | |
933 provided in the distribution: | |
934 <example> | |
935 location / { | |
936 include scgi_params; | |
937 ... | |
938 } | |
939 </example> | |
940 </para> | |
941 | |
1182
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
942 <para> |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
943 If a directive is specified with <literal>if_not_empty</literal> (1.1.11) then |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
944 such a parameter will not be passed to the server until its value is not empty: |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
945 <example> |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
946 scgi_param HTTPS $https if_not_empty; |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
947 </example> |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
948 </para> |
ec1097156f81
Scgi: restored if_not_empty lost during conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1180
diff
changeset
|
949 |
1180 | 950 </directive> |
951 | |
952 | |
953 <directive name="scgi_pass"> | |
954 <syntax><value>address</value></syntax> | |
955 <default/> | |
956 <context>location</context> | |
957 <context>if in location</context> | |
958 | |
959 <para> | |
960 Sets the address of an SCGI server. | |
961 The address can be specified as a domain name or IP address, | |
962 and an optional port: | |
963 <example> | |
964 scgi_pass localhost:9000; | |
965 </example> | |
966 or as a UNIX-domain socket path: | |
967 <example> | |
968 scgi_pass unix:/tmp/scgi.socket; | |
969 </example> | |
970 </para> | |
971 | |
972 <para> | |
973 If a domain name resolves to several addresses, all of them will be | |
974 used in a round-robin fashion. | |
975 In addition, an address can be specified as a | |
976 <link doc="ngx_http_upstream_module.xml">server group</link>. | |
977 </para> | |
978 | |
979 </directive> | |
980 | |
981 | |
982 <directive name="scgi_pass_header"> | |
983 <syntax><value>field</value></syntax> | |
984 <default/> | |
985 <context>http</context> | |
986 <context>server</context> | |
987 <context>location</context> | |
988 | |
989 <para> | |
990 Permits passing <link id="scgi_hide_header">otherwise disabled</link> header | |
991 fields from an SCGI server to a client. | |
992 </para> | |
993 | |
994 </directive> | |
995 | |
996 | |
997 <directive name="scgi_read_timeout"> | |
998 <syntax><value>time</value></syntax> | |
999 <default>60s</default> | |
1000 <context>http</context> | |
1001 <context>server</context> | |
1002 <context>location</context> | |
1003 | |
1004 <para> | |
1005 Defines a timeout for reading a response from the SCGI server. | |
1006 The timeout is set only between two successive read operations, | |
1007 not for the transmission of the whole response. | |
1008 If the SCGI server does not transmit anything within this time, | |
1009 the connection is closed. | |
1010 </para> | |
1011 | |
1012 </directive> | |
1013 | |
1014 | |
1015 <directive name="scgi_pass_request_body"> | |
1016 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
1017 <default>on</default> | |
1018 <context>http</context> | |
1019 <context>server</context> | |
1020 <context>location</context> | |
1021 | |
1022 <para> | |
1023 Indicates whether the original request body is passed | |
1024 to the SCGI server. | |
1025 See also the <link id="scgi_pass_request_headers"/> directive. | |
1026 </para> | |
1027 | |
1028 </directive> | |
1029 | |
1030 | |
1031 <directive name="scgi_pass_request_headers"> | |
1032 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
1033 <default>on</default> | |
1034 <context>http</context> | |
1035 <context>server</context> | |
1036 <context>location</context> | |
1037 | |
1038 <para> | |
1039 Indicates whether the header fields of the original request are passed | |
1040 to the SCGI server. | |
1041 See also the <link id="scgi_pass_request_body"/> directive. | |
1042 </para> | |
1043 | |
1044 </directive> | |
1045 | |
1046 | |
1047 <directive name="scgi_send_timeout"> | |
1048 <syntax><value>time</value></syntax> | |
1049 <default>60s</default> | |
1050 <context>http</context> | |
1051 <context>server</context> | |
1052 <context>location</context> | |
1053 | |
1054 <para> | |
1055 Sets a timeout for transmitting a request to the SCGI server. | |
1056 The timeout is set only between two successive write operations, | |
1057 not for the transmission of the whole request. | |
1058 If the SCGI server does not receive anything within this time, | |
1059 the connection is closed. | |
1060 </para> | |
1061 | |
1062 </directive> | |
1063 | |
1064 | |
1065 <directive name="scgi_store"> | |
1066 <syntax> | |
1067 <literal>on</literal> | | |
1068 <literal>off</literal> | | |
1069 <value>string</value></syntax> | |
1070 <default>off</default> | |
1071 <context>http</context> | |
1072 <context>server</context> | |
1073 <context>location</context> | |
1074 | |
1075 <para> | |
1076 Enables saving of files to a disk. | |
1077 The <literal>on</literal> parameter saves files with paths | |
1078 corresponding to the directives | |
1079 <link doc="ngx_http_core_module.xml" id="alias"/> or | |
1080 <link doc="ngx_http_core_module.xml" id="root"/>. | |
1081 The <literal>off</literal> parameter disables saving of files. | |
1082 In addition, the file name can be set explicitly using the | |
1083 <value>string</value> with variables: | |
1084 <example> | |
1085 scgi_store /data/www$original_uri; | |
1086 </example> | |
1087 </para> | |
1088 | |
1089 <para> | |
1090 The modification time of files is set according to the received | |
1091 <header>Last-Modified</header> response header field. | |
1092 The response is first written to a temporary file, | |
1093 and then the file is renamed. | |
1094 Starting from version 0.8.9, temporary files and the persistent store | |
1095 can be put on different file systems. | |
1096 However, be aware that in this case a file is copied | |
1097 across two file systems instead of the cheap renaming operation. | |
1098 It is thus recommended that for any given location both saved files and a | |
1099 directory holding temporary files, set by the <link id="scgi_temp_path"/> | |
1100 directive, are put on the same file system. | |
1101 </para> | |
1102 | |
1103 <para> | |
1104 This directive can be used to create local copies of static unchangeable | |
1105 files, e.g.: | |
1106 <example> | |
1107 location /images/ { | |
1184
55857cbf562d
Fixed alignment issues after mechanical conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1182
diff
changeset
|
1108 root /data/www; |
55857cbf562d
Fixed alignment issues after mechanical conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1182
diff
changeset
|
1109 error_page 404 = /fetch$uri; |
1180 | 1110 } |
1111 | |
1112 location /fetch/ { | |
1113 internal; | |
1114 | |
1115 scgi_pass backend:9000; | |
1116 ... | |
1117 | |
1118 scgi_store on; | |
1119 scgi_store_access user:rw group:rw all:r; | |
1120 scgi_temp_path /data/temp; | |
1121 | |
1184
55857cbf562d
Fixed alignment issues after mechanical conversion from fastcgi.
Ruslan Ermilov <ru@nginx.com>
parents:
1182
diff
changeset
|
1122 alias /data/www/; |
1180 | 1123 } |
1124 </example> | |
1125 </para> | |
1126 | |
1127 </directive> | |
1128 | |
1129 | |
1130 <directive name="scgi_store_access"> | |
1131 <syntax><value>users</value>:<value>permissions</value> ...</syntax> | |
1132 <default>user:rw</default> | |
1133 <context>http</context> | |
1134 <context>server</context> | |
1135 <context>location</context> | |
1136 | |
1137 <para> | |
1138 Sets access permissions for newly created files and directories, e.g.: | |
1139 <example> | |
1140 scgi_store_access user:rw group:rw all:r; | |
1141 </example> | |
1142 </para> | |
1143 | |
1144 <para> | |
1145 If any <literal>group</literal> or <literal>all</literal> access permissions | |
1146 are specified then <literal>user</literal> permissions may be omitted: | |
1147 <example> | |
1148 scgi_store_access group:rw all:r; | |
1149 </example> | |
1150 </para> | |
1151 | |
1152 </directive> | |
1153 | |
1154 | |
1155 <directive name="scgi_temp_file_write_size"> | |
1156 <syntax><value>size</value></syntax> | |
1157 <default>8k|16k</default> | |
1158 <context>http</context> | |
1159 <context>server</context> | |
1160 <context>location</context> | |
1161 | |
1162 <para> | |
1163 Limits the <value>size</value> of data written to a temporary file | |
1164 at a time, when buffering of responses from the SCGI server | |
1165 to temporary files is enabled. | |
1166 By default, <value>size</value> is limited by two buffers set by the | |
1167 <link id="scgi_buffer_size"/> and <link id="scgi_buffers"/> directives. | |
1168 The maximum size of a temporary file is set by the | |
1169 <link id="scgi_max_temp_file_size"/> directive. | |
1170 </para> | |
1171 | |
1172 </directive> | |
1173 | |
1174 | |
1175 <directive name="scgi_temp_path"> | |
1176 <syntax> | |
1177 <value>path</value> | |
1178 [<value>level1</value> | |
1179 [<value>level2</value> | |
1180 [<value>level3</value>]]]</syntax> | |
1181 <default>scgi_temp</default> | |
1182 <context>http</context> | |
1183 <context>server</context> | |
1184 <context>location</context> | |
1185 | |
1186 <para> | |
1187 Defines a directory for storing temporary files | |
1188 with data received from SCGI servers. | |
1189 Up to three-level subdirectory hierarchy can be used underneath the specified | |
1190 directory. | |
1191 For example, in the following configuration | |
1192 <example> | |
1193 scgi_temp_path /spool/nginx/scgi_temp 1 2; | |
1194 </example> | |
1195 a temporary file might look like this: | |
1196 <example> | |
1197 /spool/nginx/scgi_temp/<emphasis>7</emphasis>/<emphasis>45</emphasis>/00000123<emphasis>457</emphasis> | |
1198 </example> | |
1199 </para> | |
1200 | |
1201 </directive> | |
1202 | |
1203 </section> | |
1204 | |
1205 </module> |