comparison xml/en/docs/http/ngx_http_core_module.xml @ 106:56457a474903

If text of the link is not provided, the @id is used.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 19 Oct 2011 10:39:49 +0000
parents c76a257f3fd4
children 72524ae53106
comparison
equal deleted inserted replaced
105:1aa4f50144e4 106:56457a474903
64 </note> 64 </note>
65 </para> 65 </para>
66 66
67 <para> 67 <para>
68 For AIO to work, 68 For AIO to work,
69 <link id="sendfile">sendfile</link> 69 <link id="sendfile"/>
70 needs to be disabled: 70 needs to be disabled:
71 <example> 71 <example>
72 location /video/ { 72 location /video/ {
73 sendfile off; 73 sendfile off;
74 aio on; 74 aio on;
92 block on disk I/O and instead report back when the data are not in 92 block on disk I/O and instead report back when the data are not in
93 memory; nginx then initiates an asynchronous data load by reading 93 memory; nginx then initiates an asynchronous data load by reading
94 one byte. The FreeBSD kernel then loads the first 128K bytes 94 one byte. The FreeBSD kernel then loads the first 128K bytes
95 of a file into memory, however next reads will only load data 95 of a file into memory, however next reads will only load data
96 in 16K chunks. This can be tuned using the 96 in 16K chunks. This can be tuned using the
97 <link id="read_ahead">read_ahead</link> 97 <link id="read_ahead"/>
98 directive. 98 directive.
99 </para> 99 </para>
100 100
101 <para> 101 <para>
102 On Linux, AIO is usable starting from kernel version 2.6.22; 102 On Linux, AIO is usable starting from kernel version 2.6.22;
103 plus, it is also necessary to enable 103 plus, it is also necessary to enable
104 <link id="directio">directio</link>, 104 <link id="directio"/>,
105 otherwise reading will be blocking: 105 otherwise reading will be blocking:
106 <example> 106 <example>
107 location /video/ { 107 location /video/ {
108 aio on; 108 aio on;
109 directio 512; 109 directio 512;
112 </example> 112 </example>
113 </para> 113 </para>
114 114
115 <para> 115 <para>
116 On Linux, 116 On Linux,
117 <link id="directio">directio</link> 117 <link id="directio"/>
118 can only be used for reading blocks that are aligned on 512-byte 118 can only be used for reading blocks that are aligned on 512-byte
119 boundaries (or 4K for XFS). 119 boundaries (or 4K for XFS).
120 Reading of unaligned file's end is still made in blocking mode. 120 Reading of unaligned file's end is still made in blocking mode.
121 The same holds true for byte range requests, and for FLV requests 121 The same holds true for byte range requests, and for FLV requests
122 not from the beginning of a file: reading of unaligned data at the 122 not from the beginning of a file: reading of unaligned data at the
123 beginning and end of a file will be blocking. 123 beginning and end of a file will be blocking.
124 There is no need to turn off 124 There is no need to turn off
125 <link id="sendfile">sendfile</link> 125 <link id="sendfile"/>
126 explicitly as it is turned off automatically when 126 explicitly as it is turned off automatically when
127 <link id="directio">directio</link> 127 <link id="directio"/>
128 is used. 128 is used.
129 </para> 129 </para>
130 130
131 </directive> 131 </directive>
132 132
173 location /images/ { 173 location /images/ {
174 alias /data/w3/images/; 174 alias /data/w3/images/;
175 } 175 }
176 </example> 176 </example>
177 it is better to use the 177 it is better to use the
178 <link id="root">root</link> 178 <link id="root"/>
179 directive instead: 179 directive instead:
180 <example> 180 <example>
181 location /images/ { 181 location /images/ {
182 root /data/w3; 182 root /data/w3;
183 } 183 }
322 For most requests, a buffer of 1K bytes is enough. 322 For most requests, a buffer of 1K bytes is enough.
323 However, if a request includes long cookies, or comes from a WAP client, 323 However, if a request includes long cookies, or comes from a WAP client,
324 it may not fit into 1K. 324 it may not fit into 1K.
325 If a request line, or a request header field do not fit entirely into 325 If a request line, or a request header field do not fit entirely into
326 this buffer then larger buffers are allocated, configured by the 326 this buffer then larger buffers are allocated, configured by the
327 <link id="large_client_header_buffers">large_client_header_buffers</link> 327 <link id="large_client_header_buffers"/>
328 directive. 328 directive.
329 </para> 329 </para>
330 330
331 </directive> 331 </directive>
332 332
380 <context>server</context> 380 <context>server</context>
381 <context>location</context> 381 <context>location</context>
382 382
383 <para> 383 <para>
384 Defines a default MIME-type of a response. 384 Defines a default MIME-type of a response.
385 See also the <link id="types">types</link> directive. 385 See also the <link id="types"/> directive.
386 </para> 386 </para>
387 387
388 </directive> 388 </directive>
389 389
390 390
400 the <c-def>O_DIRECT</c-def> flag (FreeBSD, Linux), 400 the <c-def>O_DIRECT</c-def> flag (FreeBSD, Linux),
401 the <c-def>F_NOCACHE</c-def> flag (Mac OS X), 401 the <c-def>F_NOCACHE</c-def> flag (Mac OS X),
402 or the <c-func>directio</c-func> function (Solaris), 402 or the <c-func>directio</c-func> function (Solaris),
403 when reading files that are larger than the specified <argument>size</argument>. 403 when reading files that are larger than the specified <argument>size</argument>.
404 It automatically disables (0.7.15) the use of 404 It automatically disables (0.7.15) the use of
405 <link id="sendfile">sendfile</link> 405 <link id="sendfile"/>
406 for a given request. 406 for a given request.
407 It could be useful for serving large files: 407 It could be useful for serving large files:
408 <example> 408 <example>
409 directio 4m; 409 directio 4m;
410 </example> 410 </example>
411 or when using <link id="aio">aio</link> on Linux. 411 or when using <link id="aio"/> on Linux.
412 </para> 412 </para>
413 413
414 </directive> 414 </directive>
415 415
416 416
421 <context>server</context> 421 <context>server</context>
422 <context>location</context> 422 <context>location</context>
423 423
424 <para> 424 <para>
425 Sets an alignment for 425 Sets an alignment for
426 <link id="directio">directio</link>. 426 <link id="directio"/>.
427 In most cases, a 512-byte alignment is enough, however, when 427 In most cases, a 512-byte alignment is enough, however, when
428 using XFS under Linux, it needs to be increased to 4K. 428 using XFS under Linux, it needs to be increased to 4K.
429 </para> 429 </para>
430 430
431 </directive> 431 </directive>
551 Internal requests are the following: 551 Internal requests are the following:
552 552
553 <list type="bullet"> 553 <list type="bullet">
554 554
555 <listitem> 555 <listitem>
556 requests redirected by the <link id="error_page">error_page</link> directive; 556 requests redirected by the <link id="error_page"/> directive;
557 </listitem> 557 </listitem>
558 558
559 <listitem> 559 <listitem>
560 subrequests formed by the 560 subrequests formed by the
561 <command>include virtual</command> 561 <command>include virtual</command>
563 <link doc="ngx_http_ssi_module.xml">ngx_http_ssi_module</link>; 563 <link doc="ngx_http_ssi_module.xml">ngx_http_ssi_module</link>;
564 </listitem> 564 </listitem>
565 565
566 <listitem> 566 <listitem>
567 requests changed by the 567 requests changed by the
568 <link doc="ngx_http_rewrite_module.xml" id="rewrite">rewrite</link> 568 <link doc="ngx_http_rewrite_module.xml" id="rewrite"/>
569 directive of the module 569 directive of the module
570 <link doc="ngx_http_rewrite_module.xml">ngx_http_rewrite_module</link>. 570 <link doc="ngx_http_rewrite_module.xml">ngx_http_rewrite_module</link>.
571 </listitem> 571 </listitem>
572 572
573 </list> 573 </list>
720 </para> 720 </para>
721 721
722 <para> 722 <para>
723 This directive is not applicable if one wants to rate limit 723 This directive is not applicable if one wants to rate limit
724 a group of clients on the 724 a group of clients on the
725 <link id="server">server</link> 725 <link id="server"/>
726 level. 726 level.
727 If that is the case, the desired limit can be specified in the 727 If that is the case, the desired limit can be specified in the
728 <var>$limit_rate</var> 728 <var>$limit_rate</var>
729 variable: 729 variable:
730 <example> 730 <example>
1102 <context>server</context> 1102 <context>server</context>
1103 <context>location</context> 1103 <context>location</context>
1104 1104
1105 <para> 1105 <para>
1106 Enables or disables logging of errors about not found files into the 1106 Enables or disables logging of errors about not found files into the
1107 <link doc="../ngx_core_module.xml" id="error_log">error_log</link>. 1107 <link doc="../ngx_core_module.xml" id="error_log"/>.
1108 </para> 1108 </para>
1109 1109
1110 </directive> 1110 </directive>
1111 1111
1112 1112
1117 <context>server</context> 1117 <context>server</context>
1118 <context>location</context> 1118 <context>location</context>
1119 1119
1120 <para> 1120 <para>
1121 Enables or disables logging of subrequests into the 1121 Enables or disables logging of subrequests into the
1122 <link doc="ngx_http_log_module.xml" id="access_log">access_log</link>. 1122 <link doc="ngx_http_log_module.xml" id="access_log"/>.
1123 </para> 1123 </para>
1124 1124
1125 </directive> 1125 </directive>
1126 1126
1127 1127
1156 the compression. 1156 the compression.
1157 </para> 1157 </para>
1158 1158
1159 <para> 1159 <para>
1160 If a directive is specified on the 1160 If a directive is specified on the
1161 <link id="server">server</link> 1161 <link id="server"/>
1162 level, which is also a default server, its value will cover 1162 level, which is also a default server, its value will cover
1163 all virtual servers listening on the same address and port. 1163 all virtual servers listening on the same address and port.
1164 </para> 1164 </para>
1165 1165
1166 </directive> 1166 </directive>
1220 1220
1221 <listitem> 1221 <listitem>
1222 file lookup errors, such as “file not found”, “no read permission”, 1222 file lookup errors, such as “file not found”, “no read permission”,
1223 and so on. 1223 and so on.
1224 Caching of errors should be enabled separately by the 1224 Caching of errors should be enabled separately by the
1225 <link id="open_file_cache_errors">open_file_cache_errors</link> 1225 <link id="open_file_cache_errors"/>
1226 directive. 1226 directive.
1227 </listitem> 1227 </listitem>
1228 1228
1229 </list> 1229 </list>
1230 </para> 1230 </para>
1283 <context>server</context> 1283 <context>server</context>
1284 <context>location</context> 1284 <context>location</context>
1285 1285
1286 <para> 1286 <para>
1287 Enables or disables caching of file lookup errors by 1287 Enables or disables caching of file lookup errors by
1288 <link id="open_file_cache">open_file_cache</link>. 1288 <link id="open_file_cache"/>.
1289 </para> 1289 </para>
1290 1290
1291 </directive> 1291 </directive>
1292 1292
1293 1293
1300 <context>server</context> 1300 <context>server</context>
1301 <context>location</context> 1301 <context>location</context>
1302 1302
1303 <para> 1303 <para>
1304 Enables to use kernel events to validate 1304 Enables to use kernel events to validate
1305 <link id="open_file_cache">open_file_cache</link> 1305 <link id="open_file_cache"/>
1306 elements. 1306 elements.
1307 This directive works with the 1307 This directive works with the
1308 <link doc="../events.xml" id="kqueue">kqueue</link> 1308 <link doc="../events.xml" id="kqueue"/>
1309 method only. 1309 method only.
1310 Note that only NetBSD&nbsp;2.0+ and FreeBSD&nbsp;6.0+ 1310 Note that only NetBSD&nbsp;2.0+ and FreeBSD&nbsp;6.0+
1311 support events for arbitrary file system types. 1311 support events for arbitrary file system types.
1312 Other operating systems support events only for essential 1312 Other operating systems support events only for essential
1313 file systems such as UFS or FFS. 1313 file systems such as UFS or FFS.
1326 <context>location</context> 1326 <context>location</context>
1327 1327
1328 <para> 1328 <para>
1329 Sets the minimum <argument>number</argument> of file accesses during 1329 Sets the minimum <argument>number</argument> of file accesses during
1330 the period configured by the <parameter>inactive</parameter> parameter 1330 the period configured by the <parameter>inactive</parameter> parameter
1331 of the <link id="open_file_cache">open_file_cache</link> directive, 1331 of the <link id="open_file_cache"/> directive,
1332 after which a file descriptor will remain open in the cache. 1332 after which a file descriptor will remain open in the cache.
1333 </para> 1333 </para>
1334 1334
1335 </directive> 1335 </directive>
1336 1336
1342 <context>server</context> 1342 <context>server</context>
1343 <context>location</context> 1343 <context>location</context>
1344 1344
1345 <para> 1345 <para>
1346 Sets a time after which 1346 Sets a time after which
1347 <link id="open_file_cache">open_file_cache</link> 1347 <link id="open_file_cache"/>
1348 elements should be validated. 1348 elements should be validated.
1349 <!-- 1349 <!--
1350 When 1350 When
1351 <link id="open_file_cache_events">open_file_cache_events</link> 1351 <link id="open_file_cache_events"/>
1352 is enabled, open file descriptors 1352 is enabled, open file descriptors
1353 are checked only once, and then updated right after they get changed. 1353 are checked only once, and then updated right after they get changed.
1354 --> 1354 -->
1355 </para> 1355 </para>
1356 1356
1363 <context>http</context> 1363 <context>http</context>
1364 <context>server</context> 1364 <context>server</context>
1365 1365
1366 <para> 1366 <para>
1367 This directive is made obsolete by the 1367 This directive is made obsolete by the
1368 <link id="server_name_in_redirect">server_name_in_redirect</link> directive. 1368 <link id="server_name_in_redirect"/> directive.
1369 </para> 1369 </para>
1370 1370
1371 <!-- 1371 <!--
1372 <para> 1372 <para>
1373 Enables or disables optimization of hostname checking in name-based 1373 Enables or disables optimization of hostname checking in name-based
1434 <context>server</context> 1434 <context>server</context>
1435 <context>location</context> 1435 <context>location</context>
1436 1436
1437 <para> 1437 <para>
1438 Enables or disables doing several redirects using the 1438 Enables or disables doing several redirects using the
1439 <link id="error_page">error_page</link> 1439 <link id="error_page"/>
1440 directive. 1440 directive.
1441 </para> 1441 </para>
1442 1442
1443 </directive> 1443 </directive>
1444 1444
1534 1534
1535 <para> 1535 <para>
1536 A path to the file is constructed by merely adding a URI to the value 1536 A path to the file is constructed by merely adding a URI to the value
1537 of the <code>root</code> directive. 1537 of the <code>root</code> directive.
1538 If a URI need to be modified, the 1538 If a URI need to be modified, the
1539 <link id="alias">alias</link> directive should be used. 1539 <link id="alias"/> directive should be used.
1540 </para> 1540 </para>
1541 1541
1542 </directive> 1542 </directive>
1543 1543
1544 1544
1628 <para> 1628 <para>
1629 Sets a configuration for the virtual server. 1629 Sets a configuration for the virtual server.
1630 There is no clean separation between IP-based (based on the IP address) 1630 There is no clean separation between IP-based (based on the IP address)
1631 and name-based (based on the <header>Host</header> request header field) 1631 and name-based (based on the <header>Host</header> request header field)
1632 virtual servers. 1632 virtual servers.
1633 Instead, the <link id="listen">listen</link> directives describe all 1633 Instead, the <link id="listen"/> directives describe all
1634 addresses and ports that should accept connections for a server, and the 1634 addresses and ports that should accept connections for a server, and the
1635 <link id="server_name">server_name</link> directive lists all server names. 1635 <link id="server_name"/> directive lists all server names.
1636 An example configuration is provided in the 1636 An example configuration is provided in the
1637 <link doc="../virtual_hosts.xml"> 1637 <link doc="../virtual_hosts.xml">
1638 Setting Up Virtual Servers</link> document. 1638 Setting Up Virtual Servers</link> document.
1639 </para> 1639 </para>
1640 1640
1782 <context>server</context> 1782 <context>server</context>
1783 <context>location</context> 1783 <context>location</context>
1784 1784
1785 <para> 1785 <para>
1786 Enables or disables the use of the primary server name, specified by the 1786 Enables or disables the use of the primary server name, specified by the
1787 <link id="server_name">server_name</link> 1787 <link id="server_name"/>
1788 directive, in redirects issued by nginx. 1788 directive, in redirects issued by nginx.
1789 When disabled, the name from the <header>Host</header> request header field 1789 When disabled, the name from the <header>Host</header> request header field
1790 is used. 1790 is used.
1791 If this field is not present, an IP address of the server is used. 1791 If this field is not present, an IP address of the server is used.
1792 </para> 1792 </para>
1863 1863
1864 <para> 1864 <para>
1865 Enables or disables the use of 1865 Enables or disables the use of
1866 the <c-def>TCP_NOPUSH</c-def> socket option on FreeBSD 1866 the <c-def>TCP_NOPUSH</c-def> socket option on FreeBSD
1867 or the <c-def>TCP_CORK</c-def> socket option on Linux. 1867 or the <c-def>TCP_CORK</c-def> socket option on Linux.
1868 Options are enabled only when <link id="sendfile">sendfile</link> is used. 1868 Options are enabled only when <link id="sendfile"/> is used.
1869 Enabling the option allows to 1869 Enabling the option allows to
1870 <list type="bullet"> 1870 <list type="bullet">
1871 1871
1872 <listitem> 1872 <listitem>
1873 send the response header and the beginning of a file in one packet, 1873 send the response header and the beginning of a file in one packet,
2174 the <argument>name</argument> cookie 2174 the <argument>name</argument> cookie
2175 </tag-desc> 2175 </tag-desc>
2176 2176
2177 <tag-name><var>$document_root</var></tag-name> 2177 <tag-name><var>$document_root</var></tag-name>
2178 <tag-desc> 2178 <tag-desc>
2179 <link id="root">root</link> directive's value for the current request 2179 <link id="root"/> directive's value for the current request
2180 </tag-desc> 2180 </tag-desc>
2181 2181
2182 <tag-name><var>$document_uri</var></tag-name> 2182 <tag-name><var>$document_uri</var></tag-name>
2183 <tag-desc> 2183 <tag-desc>
2184 same as <var>$uri</var> 2184 same as <var>$uri</var>
2226 same as <var>$args</var> 2226 same as <var>$args</var>
2227 </tag-desc> 2227 </tag-desc>
2228 2228
2229 <tag-name><var>$realpath_root</var></tag-name> 2229 <tag-name><var>$realpath_root</var></tag-name>
2230 <tag-desc> 2230 <tag-desc>
2231 <link id="root">root</link> directive's value 2231 <link id="root"/> directive's value
2232 for the current request, with all symbolic links resolved to real paths 2232 for the current request, with all symbolic links resolved to real paths
2233 </tag-desc> 2233 </tag-desc>
2234 2234
2235 <tag-name><var>$remote_addr</var></tag-name> 2235 <tag-name><var>$remote_addr</var></tag-name>
2236 <tag-desc> 2236 <tag-desc>
2256 <tag-desc> 2256 <tag-desc>
2257 request body 2257 request body
2258 <para> 2258 <para>
2259 The variable's value is made available in locations 2259 The variable's value is made available in locations
2260 processed by the 2260 processed by the
2261 <link doc="ngx_http_proxy_module.xml" id="proxy_pass">proxy_pass</link> 2261 <link doc="ngx_http_proxy_module.xml" id="proxy_pass"/>
2262 and 2262 and
2263 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass">fastcgi_pass</link> 2263 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass"/>
2264 directives. 2264 directives.
2265 </para> 2265 </para>
2266 </tag-desc> 2266 </tag-desc>
2267 2267
2268 <tag-name><var>$request_body_file</var></tag-name> 2268 <tag-name><var>$request_body_file</var></tag-name>
2274 <link id="client_body_in_file_only">client_body_in_file_only on</link> 2274 <link id="client_body_in_file_only">client_body_in_file_only on</link>
2275 needs be specified. 2275 needs be specified.
2276 When passing the name of a temporary file in a proxied request, 2276 When passing the name of a temporary file in a proxied request,
2277 or in a request to a FastCGI server, 2277 or in a request to a FastCGI server,
2278 passing of the request body should be disabled by the 2278 passing of the request body should be disabled by the
2279 <link doc="ngx_http_proxy_module.xml" 2279 <link doc="ngx_http_proxy_module.xml" id="proxy_pass_request_body"/>
2280 id="proxy_pass_request_body">proxy_pass_request_body</link>
2281 and 2280 and
2282 <link doc="ngx_http_fastcgi_module.xml" 2281 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass_request_body"/>
2283 id="fastcgi_pass_request_body">fastcgi_pass_request_body</link>
2284 directives, respectively. 2282 directives, respectively.
2285 </para> 2283 </para>
2286 </tag-desc> 2284 </tag-desc>
2287 2285
2288 <tag-name><var>$request_completion</var></tag-name> 2286 <tag-name><var>$request_completion</var></tag-name>
2292 </tag-desc> 2290 </tag-desc>
2293 2291
2294 <tag-name><var>$request_filename</var></tag-name> 2292 <tag-name><var>$request_filename</var></tag-name>
2295 <tag-desc> 2293 <tag-desc>
2296 file path for the current query, based on the 2294 file path for the current query, based on the
2297 <link id="root">root</link> and <link id="alias">alias</link> 2295 <link id="root"/> and <link id="alias"/>
2298 directives, and the request URI 2296 directives, and the request URI
2299 </tag-desc> 2297 </tag-desc>
2300 2298
2301 <tag-name><var>$request_method</var></tag-name> 2299 <tag-name><var>$request_method</var></tag-name>
2302 <tag-desc> 2300 <tag-desc>
2322 <tag-name><var>$server_addr</var></tag-name> 2320 <tag-name><var>$server_addr</var></tag-name>
2323 <tag-desc> 2321 <tag-desc>
2324 an address of the server which accepted a request 2322 an address of the server which accepted a request
2325 <para> 2323 <para>
2326 Computing a value of this variable usually requires one system call. 2324 Computing a value of this variable usually requires one system call.
2327 To avoid a system call, the <link id="listen">listen</link> directives 2325 To avoid a system call, the <link id="listen"/> directives
2328 must specify addresses and use the <parameter>bind</parameter> parameter 2326 must specify addresses and use the <parameter>bind</parameter> parameter
2329 </para> 2327 </para>
2330 </tag-desc> 2328 </tag-desc>
2331 2329
2332 <tag-name><var>$server_name</var></tag-name> 2330 <tag-name><var>$server_name</var></tag-name>