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