Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_fastcgi_module.xml @ 298:0dcf07c393b6
English translation of the ngx_http_fastcgi_module module documentation.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 29 Dec 2011 07:56:40 +0000 |
parents | |
children | df728215db07 |
comparison
equal
deleted
inserted
replaced
297:94c8df379088 | 298:0dcf07c393b6 |
---|---|
1 <?xml version="1.0"?> | |
2 | |
3 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | |
4 | |
5 <module name="Module ngx_http_fastcgi_module" | |
6 link="/en/docs/http/ngx_http_fastcgi_module.html" | |
7 lang="en"> | |
8 | |
9 <section id="summary"> | |
10 | |
11 <para> | |
12 The <literal>ngx_http_fastcgi_module</literal> module allows to pass | |
13 requests to a FastCGI server. | |
14 </para> | |
15 | |
16 </section> | |
17 | |
18 | |
19 <section id="example" name="Example Configuration"> | |
20 | |
21 <para> | |
22 <example> | |
23 location / { | |
24 fastcgi_pass localhost:9000; | |
25 fastcgi_index index.php; | |
26 | |
27 fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; | |
28 fastcgi_param QUERY_STRING $query_string; | |
29 fastcgi_param REQUEST_METHOD $request_method; | |
30 fastcgi_param CONTENT_TYPE $content_type; | |
31 fastcgi_param CONTENT_LENGTH $content_length; | |
32 } | |
33 </example> | |
34 </para> | |
35 | |
36 </section> | |
37 | |
38 | |
39 <section id="directives" name="Directives"> | |
40 | |
41 <directive name="fastcgi_buffer_size"> | |
42 <syntax><value>size</value></syntax> | |
43 <default>4k|8k</default> | |
44 <context>http</context> | |
45 <context>server</context> | |
46 <context>location</context> | |
47 | |
48 <para> | |
49 Sets <value>size</value> of the buffer used for reading the first part | |
50 of a response received from the FastCGI server. | |
51 This part usually contains a small response header. | |
52 By default, the buffer size is equal to the size of one | |
53 buffer set by the <link id="fastcgi_buffers"/> directive. | |
54 It can be made smaller however. | |
55 </para> | |
56 | |
57 </directive> | |
58 | |
59 | |
60 <directive name="fastcgi_buffers"> | |
61 <syntax><value>number</value> <value>size</value></syntax> | |
62 <default>8 4k|8k</default> | |
63 <context>http</context> | |
64 <context>server</context> | |
65 <context>location</context> | |
66 | |
67 <para> | |
68 Sets the <value>number</value> and <value>size</value> of | |
69 buffers used for reading a response from the FastCGI server, | |
70 for a single connection. | |
71 By default, the buffer size is equal to one memory page. | |
72 This is either 4K or 8K, depending on a platform. | |
73 </para> | |
74 | |
75 </directive> | |
76 | |
77 | |
78 <directive name="fastcgi_cache"> | |
79 <syntax><value>zone</value> | <literal>off</literal></syntax> | |
80 <default>off</default> | |
81 <context>http</context> | |
82 <context>server</context> | |
83 <context>location</context> | |
84 | |
85 <para> | |
86 Defines a zone used for caching. | |
87 The same zone can be used in several places. | |
88 The <literal>off</literal> parameter disables caching inherited | |
89 from the previous configuration level. | |
90 </para> | |
91 | |
92 </directive> | |
93 | |
94 | |
95 <directive name="fastcgi_cache_bypass"> | |
96 <syntax><value>string</value> ...</syntax> | |
97 <default/> | |
98 <context>http</context> | |
99 <context>server</context> | |
100 <context>location</context> | |
101 | |
102 <para> | |
103 Defines conditions under which the response will not be taken from a cache. | |
104 If at least one value of the string parameters is not empty and is not | |
105 equal to “0” then the response will not be taken from the cache: | |
106 <example> | |
107 fastcgi_cache_bypass $cookie_nocache $arg_nocache$arg_comment; | |
108 fastcgi_cache_bypass $http_pragma $http_authorization; | |
109 </example> | |
110 Can be used along with the <link id="fastcgi_no_cache"/> directive. | |
111 </para> | |
112 | |
113 </directive> | |
114 | |
115 | |
116 <directive name="fastcgi_cache_key"> | |
117 <syntax><value>string</value></syntax> | |
118 <default/> | |
119 <context>http</context> | |
120 <context>server</context> | |
121 <context>location</context> | |
122 | |
123 <para> | |
124 Defines a key for caching, for example | |
125 <example> | |
126 fastcgi_cache_key localhost:9000$request_uri; | |
127 </example> | |
128 </para> | |
129 | |
130 </directive> | |
131 | |
132 | |
133 <directive name="fastcgi_cache_min_uses"> | |
134 <syntax><value>number</value></syntax> | |
135 <default>1</default> | |
136 <context>http</context> | |
137 <context>server</context> | |
138 <context>location</context> | |
139 | |
140 <para> | |
141 Sets the <value>number</value> of requests after which the response | |
142 will be cached. | |
143 </para> | |
144 | |
145 </directive> | |
146 | |
147 | |
148 <directive name="fastcgi_cache_path"> | |
149 <syntax> | |
150 <value>path</value> | |
151 [<literal>levels</literal>=<value>levels</value>] | |
152 <literal>keys_zone</literal>=<value>name</value>:<value>size</value> | |
153 [<literal>inactive</literal>=<value>time</value>] | |
154 [<literal>max_size</literal>=<value>size</value>]</syntax> | |
155 <default/> | |
156 <context>http</context> | |
157 | |
158 <para> | |
159 Sets path and other parameters of a cache. | |
160 Cache data are stored in files. | |
161 Both the key and file name in a cache are a result of | |
162 applying the MD5 function to the proxied URL. | |
163 | |
164 The <literal>levels</literal> parameter defines hierarchy levels of a cache. | |
165 For example, in the following configuration | |
166 <example> | |
167 fastcgi_cache_path /data/nginx/cache levels=1:2 keys_zone=one:10m; | |
168 </example> | |
169 file names in a cache will look like this: | |
170 <example> | |
171 /data/nginx/cache/<emphasis>c</emphasis>/<emphasis>29</emphasis>/b7f54b2df7773722d382f4809d650<emphasis>29c</emphasis> | |
172 </example> | |
173 </para> | |
174 | |
175 <para> | |
176 A cached response is first written to a temporary file, then a file is renamed. | |
177 Starting from version 0.8.9 temporary files and the cache can be put on | |
178 different file systems but be aware that in this case a file is copied | |
179 across two file systems instead of the cheap rename operation. | |
180 It is thus recommended that for any given location both cache and a directory | |
181 holding temporary files set by the <link id="fastcgi_temp_path"/> directive | |
182 are put on the same file system. | |
183 </para> | |
184 | |
185 <para> | |
186 In addition, all active keys and information about data are stored | |
187 in a shared memory zone, whose <value>name</value> and <value>size</value> | |
188 are configured by the <literal>keys_zone</literal> parameter. | |
189 Cached data that are not accessed during the time specified by the | |
190 <literal>inactive</literal> parameter get removed from the cache | |
191 regardless of their freshness. | |
192 By default, <literal>inactive</literal> is set to 10 minutes. | |
193 </para> | |
194 | |
195 <para> | |
196 The special process “cache manager” monitors the maximum cache size set | |
197 by the <literal>max_size</literal> parameter; | |
198 when this size is exceeded it removes the least recently used data. | |
199 </para> | |
200 | |
201 </directive> | |
202 | |
203 | |
204 <directive name="fastcgi_cache_use_stale"> | |
205 <syntax> | |
206 <literal>error</literal> | | |
207 <literal>timeout</literal> | | |
208 <literal>invalid_header</literal> | | |
209 <literal>updating</literal> | | |
210 <literal>http_500</literal> | | |
211 <literal>http_503</literal> | | |
212 <literal>http_404</literal> | | |
213 <literal>off</literal> | |
214 ...</syntax> | |
215 <default>off</default> | |
216 <context>http</context> | |
217 <context>server</context> | |
218 <context>location</context> | |
219 | |
220 <para> | |
221 If an error occurs while working with the FastCGI server it is possible | |
222 to use a stale cached response. | |
223 This directives determines in which cases it is permitted. | |
224 The directive’s parameters match those of the | |
225 <link id="fastcgi_next_upstream"/> directive. | |
226 Additionally, the <literal>updating</literal> parameter permits | |
227 to use a stale cached response if it is currently being updated. | |
228 </para> | |
229 | |
230 </directive> | |
231 | |
232 | |
233 <directive name="fastcgi_cache_valid"> | |
234 <syntax>[<value>code</value> ...] <value>time</value></syntax> | |
235 <default/> | |
236 <context>http</context> | |
237 <context>server</context> | |
238 <context>location</context> | |
239 | |
240 <para> | |
241 Sets caching time for different response codes. | |
242 For example, the following directives | |
243 <example> | |
244 fastcgi_cache_valid 200 302 10m; | |
245 fastcgi_cache_valid 404 1m; | |
246 </example> | |
247 set 10 minutes of caching for responses with codes 200 and 302, | |
248 and 1 minute for responses with code 404. | |
249 </para> | |
250 | |
251 <para> | |
252 If only caching <value>time</value> is specified | |
253 <example> | |
254 fastcgi_cache_valid 5m; | |
255 </example> | |
256 then only 200, 301, and 302 responses are cached. | |
257 </para> | |
258 | |
259 <para> | |
260 In addition, it can be specified to cache any responses using the | |
261 <literal>any</literal> parameter: | |
262 <example> | |
263 fastcgi_cache_valid 200 302 10m; | |
264 fastcgi_cache_valid 301 1h; | |
265 fastcgi_cache_valid any 1m; | |
266 </example> | |
267 </para> | |
268 | |
269 </directive> | |
270 | |
271 | |
272 <directive name="fastcgi_connect_timeout"> | |
273 <syntax><value>time</value></syntax> | |
274 <default>60s</default> | |
275 <context>http</context> | |
276 <context>server</context> | |
277 <context>location</context> | |
278 | |
279 <para> | |
280 Defines a timeout for establishing a connection with the FastCGI server. | |
281 It should be noted that this timeout cannot usually exceed 75 seconds. | |
282 </para> | |
283 | |
284 </directive> | |
285 | |
286 | |
287 <directive name="fastcgi_hide_header"> | |
288 <syntax><value>field</value></syntax> | |
289 <default/> | |
290 <context>http</context> | |
291 <context>server</context> | |
292 <context>location</context> | |
293 | |
294 <para> | |
295 By default, | |
296 nginx does not pass the header fields <header>Status</header> and | |
297 <header>X-Accel-...</header> from the response of the FastCGI | |
298 server to a client. | |
299 The <literal>fastcgi_hide_header</literal> directive sets additional fields | |
300 that will not be passed. | |
301 If, on the contrary, the passing of fields needs to be permitted, | |
302 the <link id="fastcgi_pass_header"/> directive can be used. | |
303 </para> | |
304 | |
305 </directive> | |
306 | |
307 | |
308 <directive name="fastcgi_ignore_client_abort"> | |
309 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
310 <default>off</default> | |
311 <context>http</context> | |
312 <context>server</context> | |
313 <context>location</context> | |
314 | |
315 <para> | |
316 Determines should the connection with the FastCGI server be | |
317 closed if a client closes a connection without waiting | |
318 for a response. | |
319 </para> | |
320 | |
321 </directive> | |
322 | |
323 | |
324 <directive name="fastcgi_ignore_headers"> | |
325 <syntax><value>field</value> ...</syntax> | |
326 <default/> | |
327 <context>http</context> | |
328 <context>server</context> | |
329 <context>location</context> | |
330 | |
331 <para> | |
332 Disables processing of certain response header fields from the FastCGI server. | |
333 The following fields can be ignored: <header>X-Accel-Redirect</header>, | |
334 <header>X-Accel-Expires</header>, <header>X-Accel-Limit-Rate</header> (1.1.6), | |
335 <header>X-Accel-Buffering</header> (1.1.6), | |
336 <header>X-Accel-Charset</header> (1.1.6), <header>Expires</header>, | |
337 <header>Cache-Control</header>, and <header>Set-Cookie</header> (0.8.44). | |
338 </para> | |
339 | |
340 </directive> | |
341 | |
342 | |
343 <directive name="fastcgi_index"> | |
344 <syntax><value>name</value></syntax> | |
345 <default/> | |
346 <context>http</context> | |
347 <context>server</context> | |
348 <context>location</context> | |
349 | |
350 <para> | |
351 Sets a file name that will be appended after a URI that ends with | |
352 a slash, in the value of the <var>$fastcgi_script_name</var> variable. | |
353 For example, with these settings | |
354 <example> | |
355 fastcgi_index index.php; | |
356 fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; | |
357 </example> | |
358 and the “<literal>/page.php</literal>” request, | |
359 the <literal>SCRIPT_FILENAME</literal> parameter will be equal to | |
360 “<literal>/home/www/scripts/php/page.php</literal>”, | |
361 and with the “<literal>/</literal>” request it will be equal to | |
362 “<literal>/home/www/scripts/php/index.php</literal>”. | |
363 </para> | |
364 | |
365 </directive> | |
366 | |
367 | |
368 <directive name="fastcgi_intercept_errors"> | |
369 <syntax><literal>on</literal> | <literal>off</literal></syntax> | |
370 <default>off</default> | |
371 <context>http</context> | |
372 <context>server</context> | |
373 <context>location</context> | |
374 | |
375 <para> | |
376 Determines whether FastCGI server responses with codes greater than or equal | |
377 to 400 should be passed to a client or be redirected to nginx for processing | |
378 using the <link doc="ngx_http_core_module.xml" id="error_page"/> directive. | |
379 </para> | |
380 | |
381 </directive> | |
382 | |
383 | |
384 <directive name="fastcgi_next_upstream"> | |
385 <syntax> | |
386 <literal>error</literal> | | |
387 <literal>timeout</literal> | | |
388 <literal>invalid_header</literal> | | |
389 <literal>http_500</literal> | | |
390 <literal>http_503</literal> | | |
391 <literal>http_404</literal> | | |
392 <literal>off</literal> | |
393 ...</syntax> | |
394 <default>error timeout</default> | |
395 <context>http</context> | |
396 <context>server</context> | |
397 <context>location</context> | |
398 | |
399 <para> | |
400 Specifies in which cases a request should be passed to the next server: | |
401 <list type="tag"> | |
402 | |
403 <tag-name><literal>error</literal></tag-name> | |
404 <tag-desc>an error occurred while establishing a connection with the | |
405 server, passing it a request, or reading the response header;</tag-desc> | |
406 | |
407 <tag-name><literal>timeout</literal></tag-name> | |
408 <tag-desc>a timeout has occurred while establishing a connection with the | |
409 server, passing it a request, or reading the response header;</tag-desc> | |
410 | |
411 <tag-name><literal>invalid_header</literal></tag-name> | |
412 <tag-desc>a server returned empty or invalid response;</tag-desc> | |
413 | |
414 <tag-name><literal>http_500</literal></tag-name> | |
415 <tag-desc>a server returned a response with the code 500;</tag-desc> | |
416 | |
417 <tag-name><literal>http_503</literal></tag-name> | |
418 <tag-desc>a server returned a response with the code 503;</tag-desc> | |
419 | |
420 <tag-name><literal>http_404</literal></tag-name> | |
421 <tag-desc>a server returned a response with the code 404;</tag-desc> | |
422 | |
423 <tag-name><literal>off</literal></tag-name> | |
424 <tag-desc>disables passing a request to the next server.</tag-desc> | |
425 | |
426 </list> | |
427 </para> | |
428 | |
429 <para> | |
430 It should be understood that passing a request to the next server is | |
431 only possible if a client was not sent anything yet. | |
432 That is, if an error or a timeout occurs in the middle of | |
433 transferring a response, fixing this is impossible. | |
434 </para> | |
435 | |
436 </directive> | |
437 | |
438 | |
439 <directive name="fastcgi_no_cache"> | |
440 <syntax><value>string</value> ...</syntax> | |
441 <default/> | |
442 <context>http</context> | |
443 <context>server</context> | |
444 <context>location</context> | |
445 | |
446 <para> | |
447 Defines conditions under which the response will not be saved to a cache. | |
448 If at least one value of the string parameters is not empty and is not | |
449 equal to “0” then the response will not be saved: | |
450 <example> | |
451 fastcgi_no_cache $cookie_nocache $arg_nocache$arg_comment; | |
452 fastcgi_no_cache $http_pragma $http_authorization; | |
453 </example> | |
454 Can be used along with the <link id="fastcgi_cache_bypass"/> directive. | |
455 </para> | |
456 | |
457 </directive> | |
458 | |
459 | |
460 <directive name="fastcgi_param"> | |
461 <syntax> | |
462 <value>parameter</value> <value>value</value> | |
463 [<literal>if_not_empty</literal>]</syntax> | |
464 <default/> | |
465 <context>http</context> | |
466 <context>server</context> | |
467 <context>location</context> | |
468 | |
469 <para> | |
470 Sets a <value>parameter</value> that should be passed to the FastCGI server. | |
471 A <value>value</value> can contain text, variables, and their combination. | |
472 These directives are inherited from the previous level if and | |
473 only if there are no | |
474 <literal>fastcgi_param</literal> | |
475 directives defined on the current level. | |
476 </para> | |
477 | |
478 <para> | |
479 The following example shows the minimum required settings for PHP: | |
480 <example> | |
481 fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; | |
482 fastcgi_param QUERY_STRING $query_string; | |
483 </example> | |
484 </para> | |
485 | |
486 <para> | |
487 The <literal>SCRIPT_FILENAME</literal> parameter is used in PHP for | |
488 determining the script name, and the <literal>QUERY_STRING</literal> | |
489 parameter is used to pass request parameters. | |
490 </para> | |
491 | |
492 <para> | |
493 For scripts that process <literal>POST</literal> requests, the | |
494 following three parameters are also required: | |
495 <example> | |
496 fastcgi_param REQUEST_METHOD $request_method; | |
497 fastcgi_param CONTENT_TYPE $content_type; | |
498 fastcgi_param CONTENT_LENGTH $content_length; | |
499 </example> | |
500 </para> | |
501 | |
502 <para> | |
503 If PHP was built with the <literal>--enable-force-cgi-redirect</literal> | |
504 configuration parameter, the <literal>REDIRECT_STATUS</literal> parameter | |
505 should also be passed with the value “200”: | |
506 <example> | |
507 fastcgi_param REDIRECT_STATUS 200; | |
508 </example> | |
509 </para> | |
510 | |
511 <para> | |
512 If a directive is specified with <literal>if_not_empty</literal> (1.1.11) then | |
513 such a parameter will not be passed to the server until its value is not empty: | |
514 <example> | |
515 fastcgi_param HTTPS $https if_not_empty; | |
516 </example> | |
517 </para> | |
518 | |
519 </directive> | |
520 | |
521 | |
522 <directive name="fastcgi_pass"> | |
523 <syntax><value>address</value></syntax> | |
524 <default/> | |
525 <context>location</context> | |
526 <context>if in location</context> | |
527 | |
528 <para> | |
529 Sets an address of the FastCGI server. | |
530 An address can be specified as a domain name or an address, and a port, | |
531 for example, | |
532 <example> | |
533 fastcgi_pass localhost:9000; | |
534 </example> | |
535 or as a UNIX-domain socket path: | |
536 <example> | |
537 fastcgi_pass unix:/tmp/fastcgi.socket; | |
538 </example> | |
539 </para> | |
540 | |
541 <para> | |
542 If a domain name resolves to several addresses, all of them will be | |
543 used in a round-robin fashion. | |
544 In addition, an address can be specified as a | |
545 <link doc="ngx_http_upstream_module.xml">server group</link>. | |
546 </para> | |
547 | |
548 </directive> | |
549 | |
550 | |
551 <directive name="fastcgi_pass_header"> | |
552 <syntax><value>field</value></syntax> | |
553 <default/> | |
554 <context>http</context> | |
555 <context>server</context> | |
556 <context>location</context> | |
557 | |
558 <para> | |
559 Permits to pass <link id="fastcgi_hide_header">otherwise disabled</link> header | |
560 fields from the FastCGI server to a client. | |
561 </para> | |
562 | |
563 </directive> | |
564 | |
565 | |
566 <directive name="fastcgi_read_timeout"> | |
567 <syntax><value>time</value></syntax> | |
568 <default>60s</default> | |
569 <context>http</context> | |
570 <context>server</context> | |
571 <context>location</context> | |
572 | |
573 <para> | |
574 Defines a timeout for reading a response from the FastCGI server. | |
575 A timeout is only set between two successive read operations, | |
576 not for the transmission of the whole response. | |
577 If a FastCGI server does not transmit anything within this time, | |
578 a connection is closed. | |
579 </para> | |
580 | |
581 </directive> | |
582 | |
583 | |
584 <directive name="fastcgi_send_timeout"> | |
585 <syntax><value>time</value></syntax> | |
586 <default>60s</default> | |
587 <context>http</context> | |
588 <context>server</context> | |
589 <context>location</context> | |
590 | |
591 <para> | |
592 Sets a timeout for transmitting a request to the FastCGI server. | |
593 A timeout is only set between two successive write operations, | |
594 not for the transmission of the whole request. | |
595 If a FastCGI server does not receive anything within this time, | |
596 a connection is closed. | |
597 </para> | |
598 | |
599 </directive> | |
600 | |
601 | |
602 <directive name="fastcgi_split_path_info"> | |
603 <syntax><value>regex</value></syntax> | |
604 <default/> | |
605 <context>location</context> | |
606 | |
607 <para> | |
608 Defines a regular expression that captures a value for the | |
609 <var>$fastcgi_path_info</var> variable. | |
610 A regular expression should have two captures, the first becomes | |
611 a value of the <var>$fastcgi_script_name</var> variable, the second | |
612 becomes a value of the <var>$fastcgi_path_info</var> variable. | |
613 For example, with these settings | |
614 <example> | |
615 location ~ ^(.+\.php)(.*)$ { | |
616 fastcgi_split_path_info ^(.+\.php)(.*)$; | |
617 fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name; | |
618 fastcgi_param PATH_INFO $fastcgi_path_info; | |
619 </example> | |
620 and the “<literal>/show.php/article/0001</literal>” request, | |
621 the <literal>SCRIPT_FILENAME</literal> parameter will be equal to | |
622 “<literal>/path/to/php/show.php</literal>”, and the | |
623 <literal>PATH_INFO</literal> parameter will be equal to | |
624 “<literal>/article/0001</literal>”. | |
625 </para> | |
626 | |
627 </directive> | |
628 | |
629 | |
630 <directive name="fastcgi_store"> | |
631 <syntax> | |
632 <literal>on</literal> | | |
633 <literal>off</literal> | | |
634 <value>string</value></syntax> | |
635 <default>off</default> | |
636 <context>http</context> | |
637 <context>server</context> | |
638 <context>location</context> | |
639 | |
640 <para> | |
641 Enables saving of files to a disk. | |
642 The <literal>on</literal> parameter saves files with paths | |
643 corresponding to the directives | |
644 <link doc="ngx_http_core_module.xml" id="alias"/> or | |
645 <link doc="ngx_http_core_module.xml" id="root"/>. | |
646 The <literal>off</literal> parameter disables saving of files. | |
647 In addition, the file name can be set explicitly using the | |
648 <value>string</value> with variables: | |
649 <example> | |
650 fastcgi_store /data/www$original_uri; | |
651 </example> | |
652 </para> | |
653 | |
654 <para> | |
655 The modification time of files is set according to the received | |
656 <header>Last-Modified</header> response header field. | |
657 A response is first written to a temporary file, then a file is renamed. | |
658 Starting from version 0.8.9 temporary files and the persistent store | |
659 can be put on different file systems but be aware that in this case | |
660 a file is copied across two file systems instead of the cheap rename operation. | |
661 It is thus recommended that for any given location both saved files and a | |
662 directory holding temporary files set by the <link id="fastcgi_temp_path"/> | |
663 directive are put on the same file system. | |
664 </para> | |
665 | |
666 <para> | |
667 This directive can be used to create local copies of static unchangeable | |
668 files, e.g.: | |
669 <example> | |
670 location /images/ { | |
671 root /data/www; | |
672 open_file_cache_errors off; | |
673 error_page 404 = /fetch$uri; | |
674 } | |
675 | |
676 location /fetch/ { | |
677 internal; | |
678 | |
679 fastcgi_pass backend:9000; | |
680 ... | |
681 | |
682 fastcgi_store on; | |
683 fastcgi_store_access user:rw group:rw all:r; | |
684 fastcgi_temp_path /data/temp; | |
685 | |
686 alias /data/www/; | |
687 } | |
688 </example> | |
689 </para> | |
690 | |
691 </directive> | |
692 | |
693 | |
694 <directive name="fastcgi_store_access"> | |
695 <syntax><value>users</value>:<value>permissions</value> ...</syntax> | |
696 <default>user:rw</default> | |
697 <context>http</context> | |
698 <context>server</context> | |
699 <context>location</context> | |
700 | |
701 <para> | |
702 Sets access permissions for newly created files and directories, e.g.: | |
703 <example> | |
704 fastcgi_store_access user:rw group:rw all:r; | |
705 </example> | |
706 </para> | |
707 | |
708 <para> | |
709 If any <literal>group</literal> or <literal>all</literal> access permissions | |
710 are specified then <literal>user</literal> permissions may be omitted: | |
711 <example> | |
712 fastcgi_store_access group:rw all:r; | |
713 </example> | |
714 </para> | |
715 | |
716 </directive> | |
717 | |
718 | |
719 <directive name="fastcgi_temp_path"> | |
720 <syntax> | |
721 <value>path</value> | |
722 [<value>level1</value> | |
723 [<value>level2</value> | |
724 [<value>level3</value>]]]</syntax> | |
725 <default>fastcgi_temp</default> | |
726 <context>http</context> | |
727 <context>server</context> | |
728 <context>location</context> | |
729 | |
730 <para> | |
731 Defines a directory for storing temporary files | |
732 received from another server. | |
733 Up to three-level subdirectory hierarchy can be used underneath the specified | |
734 directory. | |
735 For example, in the following configuration | |
736 <example> | |
737 fastcgi_temp_path /spool/nginx/fastcgi_temp 1 2; | |
738 </example> | |
739 a temporary file might look like this: | |
740 <example> | |
741 /spool/nginx/fastcgi_temp/<emphasis>7</emphasis>/<emphasis>45</emphasis>/00000123<emphasis>457</emphasis> | |
742 </example> | |
743 </para> | |
744 | |
745 </directive> | |
746 | |
747 </section> | |
748 | |
749 | |
750 <section id="parameters" name="Parameters Passed to a FastCGI Server"> | |
751 | |
752 <para> | |
753 HTTP request header fields are passed to the FastCGI server as parameters. | |
754 In applications and scripts running as FastCGI servers, | |
755 these parameters are usually made available as environment variables. | |
756 For example, the <header>User-Agent</header> header field is passed as the | |
757 <literal>HTTP_USER_AGENT</literal> parameter. | |
758 In addition to HTTP request header fields it is possible to pass arbitrary | |
759 parameters using the <link id="fastcgi_param"/> directive. | |
760 </para> | |
761 | |
762 </section> | |
763 | |
764 | |
765 <section id="variables" name="Embedded Variables"> | |
766 | |
767 <para> | |
768 The <literal>ngx_http_fastcgi_module</literal> module supports embedded variables | |
769 that can be used to set parameters using the | |
770 <link id="fastcgi_param"/> directive: | |
771 <list type="tag"> | |
772 | |
773 <tag-name><var>$fastcgi_script_name</var></tag-name> | |
774 <tag-desc> | |
775 request URI or, if a URI ends with a slash, request URI with an index file | |
776 name configured by the <link id="fastcgi_index"/> directive appended to it. | |
777 This variable can be used to set the | |
778 <literal>SCRIPT_FILENAME</literal> and <literal>PATH_TRANSLATED</literal> | |
779 parameters that determine the script name in PHP. | |
780 For example, for the “<literal>/info/</literal>” request with the | |
781 following directives | |
782 <example> | |
783 fastcgi_index index.php; | |
784 fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; | |
785 </example> | |
786 the <literal>SCRIPT_FILENAME</literal> parameter will be equal to | |
787 “<literal>/home/www/scripts/php/info/index.php</literal>”. | |
788 | |
789 <para> | |
790 When using the <link id="fastcgi_split_path_info"/> directive, | |
791 the <var>$fastcgi_script_name</var> variable equals to the value of | |
792 the first capture set by the directive. | |
793 </para> | |
794 </tag-desc> | |
795 | |
796 <tag-name><var>$fastcgi_path_info</var></tag-name> | |
797 <tag-desc>the value of the second capture set by the | |
798 <link id="fastcgi_split_path_info"/> directive. | |
799 This variable can be used to set the | |
800 <literal>PATH_INFO</literal> parameter. | |
801 </tag-desc> | |
802 | |
803 </list> | |
804 </para> | |
805 | |
806 </section> | |
807 | |
808 </module> |