Finished initial translation of the Core and HTTP Core modules.

This commit is contained in:
Ruslan Ermilov 2011-09-06 13:42:40 +00:00
parent 12a9b32cca
commit fbbde8871e
2 changed files with 477 additions and 227 deletions

View File

@ -23,7 +23,7 @@ on FreeBSD and Linux.
</para> </para>
<para> <para>
On FreeBSD, AIO is usable used starting from FreeBSD 4.3. On FreeBSD, AIO is usable starting from FreeBSD&nbsp;4.3.
AIO can either be linked statically into a kernel: AIO can either be linked statically into a kernel:
<example> <example>
options VFS_AIO options VFS_AIO
@ -38,14 +38,14 @@ kldload aio
In FreeBSD versions 5 and 6, enabling AIO statically, or dynamically In FreeBSD versions 5 and 6, enabling AIO statically, or dynamically
when booting the kernel, will cause the entire networking subsystem when booting the kernel, will cause the entire networking subsystem
to use the Giant lock that can impact overall performance negatively. to use the Giant lock that can impact overall performance negatively.
This limitation has been removed in FreeBSD 6.4-STABLE in 2009, and in This limitation has been removed in FreeBSD&nbsp;6.4-STABLE in 2009, and in
FreeBSD 7. FreeBSD&nbsp;7.
However, starting from FreeBSD 5.3, it's possible to enable AIO However, starting from FreeBSD&nbsp;5.3 it is possible to enable AIO
without the penalty of running the networking subsystem under a without the penalty of running the networking subsystem under a
Giant lock&mdash;for this to work, the AIO module needs to be loaded Giant lock&mdash;for this to work, the AIO module needs to be loaded
after the kernel has booted. after the kernel has booted.
In this case, the following message will appear in In this case, the following message will appear in
<code>/var/log/messages</code> <pathname>/var/log/messages</pathname>
<example> <example>
WARNING: Network stack Giant-free, but aio requires Giant. WARNING: Network stack Giant-free, but aio requires Giant.
Consider adding 'options NET_WITH_GIANT' or setting debug.mpsafenet=0 Consider adding 'options NET_WITH_GIANT' or setting debug.mpsafenet=0
@ -76,7 +76,7 @@ location /video/ {
</para> </para>
<para> <para>
In addition, starting from FreeBSD 5.2.1 and nginx 0.8.12, AIO can In addition, starting from FreeBSD&nbsp;5.2.1 and nginx&nbsp;0.8.12, AIO can
also be used to pre-load data for <c-func>sendfile</c-func>: also be used to pre-load data for <c-func>sendfile</c-func>:
<example> <example>
location /video/ { location /video/ {
@ -115,7 +115,7 @@ On Linux,
<link id="directio">directio</link> <link id="directio">directio</link>
can only be used for reading blocks that are aligned on 512-byte can only be used for reading blocks that are aligned on 512-byte
boundaries (or 4K for XFS). boundaries (or 4K for XFS).
Reading of unaligned file's tail is still made in blocking mode. Reading of unaligned file's end is still made in blocking mode.
The same holds true for byte range requests, and for FLV requests The same holds true for byte range requests, and for FLV requests
not from the beginning of a file: reading of unaligned data at the not from the beginning of a file: reading of unaligned data at the
beginning and end of a file will be blocking. beginning and end of a file will be blocking.
@ -142,8 +142,10 @@ location /i/ {
alias /data/w3/images/; alias /data/w3/images/;
} }
</example> </example>
the request of "/i/top.gif" will be responded the request of
with the file "/data/w3/images/top.gif". <dq><code>/i/top.gif</code></dq> will be responded
with the file
<dq><pathname>/data/w3/images/top.gif</pathname></dq>.
</para> </para>
<para> <para>
@ -169,7 +171,7 @@ location /images/ {
alias /data/w3/images/; alias /data/w3/images/;
} }
</example> </example>
it's better to use the it is better to use the
<link id="root">root</link> <link id="root">root</link>
directive instead: directive instead:
<example> <example>
@ -205,12 +207,12 @@ method of the
</para> </para>
<para> <para>
When set to the value <code>on</code>, temporary files are not When set to the value <value>on</value>, temporary files are not
removed after request processing. removed after request processing.
</para> </para>
<para> <para>
The value <code>clean</code> will cause the temporary files The value <value>clean</value> will cause the temporary files
left after request processing to be removed. left after request processing to be removed.
</para> </para>
@ -317,7 +319,7 @@ Sets buffer size for reading client request header.
For most requests, a buffer of 1K bytes is enough. For most requests, a buffer of 1K bytes is enough.
However, if a request includes long cookies, or comes from a WAP client, However, if a request includes long cookies, or comes from a WAP client,
it may not fit into 1K. it may not fit into 1K.
If a request line, or a request header line do not fit entirely into If a request line, or a request header field do not fit entirely into
this buffer then larger buffers are allocated, configured by the this buffer then larger buffers are allocated, configured by the
<link id="large_client_header_buffers">large_client_header_buffers</link> <link id="large_client_header_buffers">large_client_header_buffers</link>
directive. directive.
@ -354,7 +356,7 @@ is returned.
Sets the maximum allowed size of the client request body, Sets the maximum allowed size of the client request body,
specified in the specified in the
<header>Content-Length</header> <header>Content-Length</header>
request header line. request header field.
If <argument>size</argument> is greater than the configured value, the If <argument>size</argument> is greater than the configured value, the
<http-error code="413" text="Request Entity Too Large"/> <http-error code="413" text="Request Entity Too Large"/>
error is returned to a client. error is returned to a client.
@ -425,7 +427,7 @@ using XFS under Linux, it needs to be increased to 4K.
<directive name="error_page"> <directive name="error_page">
<syntax>error_page <syntax>error_page
<argument>code ...</argument> <argument>code</argument> ...
[<value>=</value>[<argument>response</argument>]] [<value>=</value>[<argument>response</argument>]]
<argument>uri</argument> <argument>uri</argument>
</syntax> </syntax>
@ -438,13 +440,15 @@ using XFS under Linux, it needs to be increased to 4K.
<para> <para>
Defines the URI that will be shown for the specified errors. Defines the URI that will be shown for the specified errors.
These directives are inherited from the previous level if and These directives are inherited from the previous level if and
only if there are no <code>error_page</code> directives on only if there are no
<link doc="../core_module.xml" id="error_page">error_page</link>
directives on
the current level. the current level.
A URI value can contain variables. A URI value can contain variables.
</para> </para>
<para> <para>
Example usage: Example:
<example> <example>
error_page 404 /404.html; error_page 404 /404.html;
error_page 502 503 504 /50x.html; error_page 502 503 504 /50x.html;
@ -460,7 +464,7 @@ error_page 404 =200 /empty.gif;
</para> </para>
<para> <para>
If an error response is processed by a proxied server, or a FastCGI-server, If an error response is processed by a proxied server, or a FastCGI server,
and the server may return different response codes (e.g., 200, 302, 401 and the server may return different response codes (e.g., 200, 302, 401
or 404), it is possible to respond with a returned code: or 404), it is possible to respond with a returned code:
<example> <example>
@ -502,22 +506,25 @@ with the time in the
<header>If-Modified-Since</header> <header>If-Modified-Since</header>
request header: request header:
<list type="bullet"> <list type="tag">
<listitem> <tag-name><value>off</value></tag-name>
<value>off</value>&mdash;the <tag-desc>
the
<header>If-Modified-Since</header> request header is ignored (0.7.34); <header>If-Modified-Since</header> request header is ignored (0.7.34);
</listitem> </tag-desc>
<listitem> <tag-name><value>exact</value></tag-name>
<value>exact</value>&mdash;exact match; <tag-desc>
</listitem> exact match;
</tag-desc>
<listitem> <tag-name><value>before</value></tag-name>
<value>before</value>&mdash;modification time of a response is <tag-desc>
modification time of a response is
less than or equal to the time in the <header>If-Modified-Since</header> less than or equal to the time in the <header>If-Modified-Since</header>
request header. request header.
</listitem> </tag-desc>
</list> </list>
</para> </para>
@ -560,7 +567,7 @@ directive of the
</para> </para>
<para> <para>
Example usage: Example:
<example> <example>
error_page 404 /404.html; error_page 404 /404.html;
@ -602,14 +609,14 @@ made through one keep-alive connection.
The first argument sets a timeout during which a keep-alive The first argument sets a timeout during which a keep-alive
client connection will stay open on the server side. client connection will stay open on the server side.
The optional second argument sets a value in the The optional second argument sets a value in the
"<header>Keep-Alive: timeout=</header><argument>time</argument>" <dq><header>Keep-Alive: timeout=<argument>time</argument></header></dq>
response header. response header.
Two arguments may differ. Two arguments may differ.
</para> </para>
<para> <para>
The The
"<header>Keep-Alive: timeout=</header>" <dq><header>Keep-Alive: timeout=</header></dq>
is understood by Mozilla and Konqueror. is understood by Mozilla and Konqueror.
MSIE will close keep-alive connection in about 60 seconds. MSIE will close keep-alive connection in about 60 seconds.
</para> </para>
@ -629,7 +636,7 @@ buffers used when reading large client request headers.
A request line cannot exceed the size of one buffer, or the A request line cannot exceed the size of one buffer, or the
<http-error code="414" text="Request URI too large"/> <http-error code="414" text="Request URI too large"/>
error is returned. error is returned.
A request header line cannot exceed the size of one buffer as well, or the A request header field cannot exceed the size of one buffer as well, or the
<http-error code="400" text="Bad request"/> <http-error code="400" text="Bad request"/>
error is returned. error is returned.
Buffers are allocated only on demand. Buffers are allocated only on demand.
@ -813,50 +820,62 @@ parameter can have several additional parameters specific to system calls
Starting from version 0.8.21, these parameters can be specified in any Starting from version 0.8.21, these parameters can be specified in any
<code>listen</code> directive, but only once for the given <code>listen</code> directive, but only once for the given
<argument>address</argument>:<argument>port</argument> pair. <argument>address</argument>:<argument>port</argument> pair.
<list type="bullet"> <list type="tag">
<listitem> <tag-name>
<parameter>backlog</parameter>=<argument>number</argument>&mdash; <parameter>backlog</parameter>=<argument>number</argument>
</tag-name>
<tag-desc>
sets the <parameter>backlog</parameter> parameter in the sets the <parameter>backlog</parameter> parameter in the
<c-func>listen</c-func> call. <c-func>listen</c-func> call.
By default, <parameter>backlog</parameter> equals -1 on FreeBSD By default, <parameter>backlog</parameter> equals -1 on FreeBSD
and 511 on other platforms. and 511 on other platforms.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>rcvbuf</parameter>=<argument>size</argument>&mdash; <parameter>rcvbuf</parameter>=<argument>size</argument>
</tag-name>
<tag-desc>
sets the <c-def>SO_RCVBUF</c-def> parameter for the listening socket. sets the <c-def>SO_RCVBUF</c-def> parameter for the listening socket.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>sndbuf</parameter>=<argument>size</argument>&mdash; <parameter>sndbuf</parameter>=<argument>size</argument>
</tag-name>
<tag-desc>
sets the <c-def>SO_SNDBUF</c-def> parameter for the listening socket. sets the <c-def>SO_SNDBUF</c-def> parameter for the listening socket.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>accept_filter</parameter>=<argument>filter</argument>&mdash; <parameter>accept_filter</parameter>=<argument>filter</argument>
</tag-name>
<tag-desc>
sets the name of the accept filter. sets the name of the accept filter.
This works only on FreeBSD, acceptable values are <value>dataready</value> This works only on FreeBSD, acceptable values are <value>dataready</value>
and <value>httpready</value>. and <value>httpready</value>.
On receiving <c-def>SIGHUP</c-def> signal, an accept filter can only be On receipt of the <c-def>SIGHUP</c-def> signal, an accept filter can only be
changed in recent versions of FreeBSD, starting from 6.0, 5.4-STABLE changed in recent versions of FreeBSD, starting from 6.0, 5.4-STABLE
and 4.11-STABLE. and 4.11-STABLE.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>deferred</parameter>&mdash; <parameter>deferred</parameter>
</tag-name>
<tag-desc>
instructs to use a deferred <c-func>accept</c-func> on Linux instructs to use a deferred <c-func>accept</c-func> on Linux
using the <c-def>TCP_DEFER_ACCEPT</c-def> option. using the <c-def>TCP_DEFER_ACCEPT</c-def> option.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>bind</parameter>&mdash; <parameter>bind</parameter>
</tag-name>
<tag-desc>
specifies to make a separate <c-func>bind</c-func> call for a given specifies to make a separate <c-func>bind</c-func> call for a given
<argument>address</argument>:<argument>port</argument> pair. <argument>address</argument>:<argument>port</argument> pair.
This is because nginx will only <c-func>bind</c-func> to This is because nginx will only <c-func>bind</c-func> to
<code>*</code>:<argument>port</argument> <code>*</code>:<argument>port</argument>
if there are several <code>listen</code> directives with if there are several <code>listen</code> directives with
the same port and different addresses, and one of the the same port but different addresses, and one of the
<code>listen</code> directives listens on all addresses <code>listen</code> directives listens on all addresses
for the given port (<code>*</code>:<argument>port</argument>). for the given port (<code>*</code>:<argument>port</argument>).
It should be noted that in this case a <c-func>getsockname</c-func> It should be noted that in this case a <c-func>getsockname</c-func>
@ -867,17 +886,21 @@ If parameters <parameter>backlog</parameter>, <parameter>rcvbuf</parameter>,
<parameter>deferred</parameter> are used then for a given <parameter>deferred</parameter> are used then for a given
<argument>address</argument>:<argument>port</argument> pair <argument>address</argument>:<argument>port</argument> pair
a separate <c-func>bind</c-func> call will always be made. a separate <c-func>bind</c-func> call will always be made.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>ipv6only</parameter>=<value>on</value>|<value>off</value>&mdash; <parameter>ipv6only</parameter>=<value>on</value>|<value>off</value>
</tag-name>
<tag-desc>
this parameter (0.7.42) sets the value of the <c-def>IPV6_V6ONLY</c-def> this parameter (0.7.42) sets the value of the <c-def>IPV6_V6ONLY</c-def>
parameter for the listening socket. parameter for the listening socket.
This parameter can only be set once on start. This parameter can only be set once on start.
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>ssl</parameter>&mdash; <parameter>ssl</parameter>
</tag-name>
<tag-desc>
this parameter (0.7.14) does not relate to system calls this parameter (0.7.14) does not relate to system calls
<c-func>listen</c-func> and <c-func>bind</c-func>, but allows to <c-func>listen</c-func> and <c-func>bind</c-func>, but allows to
specify that all connections accepted on this port should work in specify that all connections accepted on this port should work in
@ -888,7 +911,7 @@ in both HTTP and HTTPS modes simultaneously.
listen 80; listen 80;
listen 443 default ssl; listen 443 default ssl;
</example> </example>
</listitem> </tag-desc>
</list> </list>
</para> </para>
@ -922,8 +945,8 @@ listen 127.0.0.1 default accept_filter=dataready backlog=1024;
Sets a configuration based on a request URI. Sets a configuration based on a request URI.
A location can either be defined by a prefix string, or by a regular expression. A location can either be defined by a prefix string, or by a regular expression.
Regular expressions are specified by prepending them with the Regular expressions are specified by prepending them with the
"<value>~*</value>" prefix (for case-insensitive matching), or with the <dq><value>~*</value></dq> prefix (for case-insensitive matching), or with the
"<value>~</value>" prefix (for case-sensitive matching). <dq><value>~</value></dq> prefix (for case-sensitive matching).
To find a location matching a given request, nginx first checks To find a location matching a given request, nginx first checks
locations defined using the prefix strings (prefix locations). locations defined using the prefix strings (prefix locations).
Amongst them, the most specific one is searched. Amongst them, the most specific one is searched.
@ -947,29 +970,29 @@ be used in other directives.
</para> </para>
<para> <para>
If the most specific prefix location has the "<value>^~</value>" prefix If the most specific prefix location has the <dq><value>^~</value></dq> prefix
then regular expressions are not checked. then regular expressions are not checked.
</para> </para>
<para> <para>
Also, using the "<value>=</value>" prefix it's possible to define Also, using the <dq><value>=</value></dq> prefix it is possible to define
an exact match of URI and location. an exact match of URI and location.
If an exact match is found, the search terminates. If an exact match is found, the search terminates.
For example, if a "<code>/</code>" request happens frequently, For example, if a <dq><code>/</code></dq> request happens frequently,
defining "<code>location = /</code>" will speed up the processing defining <dq><code>location = /</code></dq> will speed up the processing
of these requests, as search terminates right after the first of these requests, as search terminates right after the first
comparison. comparison.
</para> </para>
<para> <para>
In versions from 0.7.1 to 0.8.41, if a request matched the prefix In versions from 0.7.1 to 0.8.41, if a request matched the prefix
location without the "<value>=</value>" and "<value>^~</value>" location without the <dq><value>=</value></dq> and <dq><value>^~</value></dq>
prefixes, the search also terminated and regular expressions were prefixes, the search also terminated and regular expressions were
not checked. not checked.
</para> </para>
<para> <para>
Let's illustrate the above by an example: Let's illustrate the above by example:
<example> <example>
location = / { location = / {
[ configuration A ] [ configuration A ]
@ -987,15 +1010,16 @@ location ~* \.(gif|jpg|jpeg)$ {
[ configuration D ] [ configuration D ]
} }
</example> </example>
The "<code>/</code>" request will match configuration A, The <dq><code>/</code></dq> request will match configuration A,
the "<code>/documents/document.html</code>" request&mdash;configuration B, the <dq><code>/documents/document.html</code></dq> request will match
the "<code>/images/1.gif</code>" request&mdash;configuration C, and configuration B,
the "<code>/documents/1.jpg</code>" request&mdash;configuration D. the <dq><code>/images/1.gif</code></dq> request will match configuration C, and
the <dq><code>/documents/1.jpg</code></dq> request will match configuration D.
</para> </para>
<para> <para>
The "<code>@</code>" prefix defines a named location. The <dq><value>@</value></dq> prefix defines a named location.
Such a location isn't used for a regular request processing, but instead Such a location is not used for a regular request processing, but instead
used for request redirection. used for request redirection.
</para> </para>
@ -1050,20 +1074,20 @@ in a URI into a single slash.
<para> <para>
Note that compression is essential for the correct prefix string Note that compression is essential for the correct prefix string
and regular expressions location matching. and regular expressions location matching.
Without it, the "<code>//scripts/one.php</code>" request would not match Without it, the <dq><code>//scripts/one.php</code></dq> request would not match
<example> <example>
location /scripts/ { location /scripts/ {
... ...
} }
</example> </example>
and might be processed as a static file, and might be processed as a static file,
so it gets converted to "<code>/scripts/one.php</code>". so it gets converted to <dq><code>/scripts/one.php</code></dq>.
</para> </para>
<para> <para>
Turning the compression <value>off</value> can become necessary if a URI Turning the compression <value>off</value> can become necessary if a URI
contains base64-encoded names, since base64 uses the "/" character internally. contains base64-encoded names, since base64 uses the "/" character internally.
However, for security considerations, it's better to avoid turning off However, for security considerations, it is better to avoid turning off
the compression. the compression.
</para> </para>
@ -1142,24 +1166,31 @@ directive.
<para> <para>
The directive has the following parameters: The directive has the following parameters:
<list type="bullet"> <list type="tag">
<listitem> <tag-name>
<parameter>max</parameter>&mdash; <parameter>max</parameter>
</tag-name>
<tag-desc>
sets the maximum number of elements in the cache; sets the maximum number of elements in the cache;
on cache overflow the least recently used (LRU) elements get removed; on cache overflow the least recently used (LRU) elements get removed;
</listitem> </tag-desc>
<listitem> <tag-name>
<parameter>inactive</parameter>&mdash; <parameter>inactive</parameter>
</tag-name>
<tag-desc>
defines a time, after which the element gets removed from the cache defines a time, after which the element gets removed from the cache
if there were no accesses to it during this time; if there were no accesses to it during this time;
by default, it is 60 seconds; by default, it is 60 seconds;
</listitem> </tag-desc>
<listitem> <tag-name>
<value>off</value>&mdash;disables the cache. <value>off</value>
</listitem> </tag-name>
<tag-desc>
disables the cache.
</tag-desc>
</list> </list>
</para> </para>
@ -1170,7 +1201,10 @@ Example:
open_file_cache max=1000 inactive=20s; open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s; open_file_cache_valid 30s;
open_file_cache_min_uses 2; open_file_cache_min_uses 2;
open_file_cache_errors on;<!-- open_file_cache_events on; --> open_file_cache_errors on;
<!--
open_file_cache_events on;
-->
</example> </example>
</para> </para>
@ -1316,7 +1350,7 @@ system call is used, so the <argument>size</argument> argument is ignored.
<para> <para>
On FreeBSD, the On FreeBSD, the
<code>fcntl(O_READAHEAD,</code><argument>size</argument><code>)</code> <code>fcntl(O_READAHEAD,</code><argument>size</argument><code>)</code>
system call is used, supported in FreeBSD 9.0-CURRENT. system call is used, supported in FreeBSD&nbsp;9.0-CURRENT.
FreeBSD&nbsp;7 needs to be FreeBSD&nbsp;7 needs to be
<link doc="http://sysoev.ru/freebsd/patch.readahead.txt">patched</link>. <link doc="http://sysoev.ru/freebsd/patch.readahead.txt">patched</link>.
</para> </para>
@ -1341,7 +1375,8 @@ directive.
<directive name="reset_timedout_connection"> <directive name="reset_timedout_connection">
<syntax>reset_timedout_connection <value>on</value> | <value>off</value></syntax> <syntax>reset_timedout_connection
<value>on</value> | <value>off</value></syntax>
<default>reset_timedout_connection off</default> <default>reset_timedout_connection off</default>
<context>http</context> <context>http</context>
<context>server</context> <context>server</context>
@ -1416,8 +1451,9 @@ location /i/ {
root /data/w3; root /data/w3;
} }
</example> </example>
the request of "/i/top.gif" will be responded <dq><code>/i/top.gif</code></dq> will be responded
with the file "/data/w3/images/top.gif". with the file
<dq><pathname>/data/w3/i/top.gif</pathname></dq>.
</para> </para>
<para> <para>
@ -1514,7 +1550,7 @@ Enables or disables the use of
<para> <para>
Sets a configuration for the virtual server. Sets a configuration for the virtual server.
There is no clean separation between IP-based (based on the IP address) There is no clean separation between IP-based (based on the IP address)
and name-based (based on the <header>Host</header> header string) and name-based (based on the <header>Host</header> request header field)
virtual servers. virtual servers.
Instead, the <link id="listen">listen</link> directives describe all Instead, the <link id="listen">listen</link> directives describe all
addresses and ports that should accept connections for a server, and the addresses and ports that should accept connections for a server, and the
@ -1528,7 +1564,7 @@ Setting Up Virtual Servers</link> document.
<directive name="server_name"> <directive name="server_name">
<syntax>server_name <argument>name ...</argument></syntax> <syntax>server_name <argument>name</argument> ...</syntax>
<default>server_name hostname</default> <default>server_name hostname</default>
<context>server</context> <context>server</context>
@ -1544,7 +1580,7 @@ server {
<para> <para>
The first name becomes a primary server name. The first name becomes a primary server name.
By default, the machine's hostname is used. By default, the machine's hostname is used.
Server names can include an asterisk ("<code>*</code>") Server names can include an asterisk (<dq><code>*</code></dq>)
to replace the first or last part of a name: to replace the first or last part of a name:
<example> <example>
server { server {
@ -1564,7 +1600,7 @@ server {
<para> <para>
It is also possible to use regular expressions in server names, It is also possible to use regular expressions in server names,
prepending the name with a tilde ("<code>~</code>"): prepending the name with a tilde (<dq><code>~</code></dq>):
<example> <example>
server { server {
server_name www.example.com ~^www\d+\.example\.com$; server_name www.example.com ~^www\d+\.example\.com$;
@ -1617,7 +1653,7 @@ server {
</para> </para>
<para> <para>
Starting from version 0.7.11, it is possible to specify an empty name "": Starting from version 0.7.11, it is possible to specify an empty name:
<example> <example>
server { server {
server_name www.example.com ""; server_name www.example.com "";
@ -1636,11 +1672,11 @@ full names
</listitem> </listitem>
<listitem> <listitem>
names with the prefix mask&mdash;*.example.com names with the prefix mask, e.g. <dq><code>*.example.com</code></dq>
</listitem> </listitem>
<listitem> <listitem>
names with the suffix mask&mdash;mail.* names with the suffix mask, e.g. <dq><code>mail.*</code></dq>
</listitem> </listitem>
<listitem> <listitem>
@ -1664,9 +1700,9 @@ regular expressions
Enables or disables the use of the primary server name, specified by the Enables or disables the use of the primary server name, specified by the
<link id="server_name">server_name</link> <link id="server_name">server_name</link>
directive, in redirects issued by nginx. directive, in redirects issued by nginx.
When disabled, the name from the <header>Host</header> request header string When disabled, the name from the <header>Host</header> request header field
is used. is used.
If there's no such a string, an IP address of the server is used. If this field is not present, an IP address of the server is used.
</para> </para>
</directive> </directive>
@ -1710,7 +1746,7 @@ For more information, please refer to
<para> <para>
Enables or disables emitting of nginx version in error messages and in the Enables or disables emitting of nginx version in error messages and in the
<header>Server</header> response header string. <header>Server</header> response header field.
</para> </para>
</directive> </directive>
@ -1763,8 +1799,14 @@ send a file in full packets.
<directive name="try_files"> <directive name="try_files">
<syntax>try_files <argument>file ... uri</argument></syntax> <syntax>try_files
<syntax>try_files <argument>file ...</argument> =<argument>code</argument></syntax> <argument>file</argument> ...
<argument>uri</argument>
</syntax>
<syntax>try_files
<argument>file</argument> ...
=<argument>code</argument>
</syntax>
<default/> <default/>
<context>location</context> <context>location</context>
@ -1773,7 +1815,7 @@ Checks the existence of files in the specified order, and uses
the first found file for request processing; the processing the first found file for request processing; the processing
is performed in this location's context. is performed in this location's context.
It is possible to check the directory existence by specifying It is possible to check the directory existence by specifying
the slash at the end of a name, e.g. "<code>$uri/</code>". the slash at the end of a name, e.g. <dq><code>$uri/</code></dq>.
If none of the files were found, an internal redirect to the If none of the files were found, an internal redirect to the
<argument>uri</argument> specified by the last argument is made. <argument>uri</argument> specified by the last argument is made.
As of version 0.7.51, the last argument can also be a As of version 0.7.51, the last argument can also be a
@ -1908,11 +1950,12 @@ types {
<para> <para>
A sufficiently full mapping table is distributed with nginx in the A sufficiently full mapping table is distributed with nginx in the
<code>conf/mime.types</code> file. <pathname>conf/mime.types</pathname> file.
</para> </para>
<para> <para>
To make a particular location emit the "<code>application/octet-stream</code>" To make a particular location emit the
<dq><code>application/octet-stream</code></dq>
MIME type for all requests, try the following: MIME type for all requests, try the following:
<example> <example>
location /download/ { location /download/ {
@ -1932,11 +1975,218 @@ location /download/ {
<context>server</context> <context>server</context>
<para> <para>
Enables or disables the use of underscores in client request header strings. Enables or disables the use of underscores in client request header fields.
</para> </para>
</directive> </directive>
</section> </section>
<section id="variables" name="Embedded Variables">
<para>
The http_core module supports embedded variables with names matching
those of the Apache Server.
First of all, these are variables representing client request header
fields, such as, <var>$http_user_agent</var>, <var>$http_cookie</var>,
and so on.
It also supports other variables:
<list type="tag">
<tag-name><var>$args</var></tag-name>
<tag-desc>
arguments in the request line
</tag-desc>
<tag-name><var>$arg_</var><argument>name</argument></tag-name>
<tag-desc>
argument <argument>name</argument> in the request line
</tag-desc>
<tag-name><var>$binary_remote_addr</var></tag-name>
<tag-desc>
client address in a binary form, value's length is always 4 bytes
</tag-desc>
<tag-name><var>$content_length</var></tag-name>
<tag-desc>
<header>Content-Length</header> request header field
</tag-desc>
<tag-name><var>$content_type</var></tag-name>
<tag-desc>
<header>Content-Type</header> request header field
</tag-desc>
<tag-name><var>$cookie_</var><argument>name</argument></tag-name>
<tag-desc>
the <argument>name</argument> cookie
</tag-desc>
<tag-name><var>$document_root</var></tag-name>
<tag-desc>
<link id="root">root</link> directive's value for the current request
</tag-desc>
<tag-name><var>$document_uri</var></tag-name>
<tag-desc>
same as <var>$uri</var>
</tag-desc>
<tag-name><var>$host</var></tag-name>
<tag-desc>
<header>Host</header> request header field,
or the server name matching a request if this field is not present
</tag-desc>
<tag-name><var>$hostname</var></tag-name>
<tag-desc>
host name
</tag-desc>
<tag-name><var>$http_</var><argument>name</argument></tag-name>
<tag-desc>
the <argument>name</argument> request header field
</tag-desc>
<tag-name><var>$is_args</var></tag-name>
<tag-desc>
<dq><code>?</code></dq> if a request line has arguments,
or an empty string otherwise
</tag-desc>
<tag-name><var>$limit_rate</var></tag-name>
<tag-desc>
allows for connection rate limiting
</tag-desc>
<tag-name><var>$pid</var></tag-name>
<tag-desc>
PID of the worker process
</tag-desc>
<tag-name><var>$request_method</var></tag-name>
<tag-desc>
request method, usually
<dq><code>GET</code></dq> or <dq><code>POST</code></dq>
</tag-desc>
<tag-name><var>$remote_addr</var></tag-name>
<tag-desc>
client address
</tag-desc>
<tag-name><var>$remote_port</var></tag-name>
<tag-desc>
client port
</tag-desc>
<tag-name><var>$remote_user</var></tag-name>
<tag-desc>
user name supplied with the Basic authentication
</tag-desc>
<tag-name><var>$realpath_root</var></tag-name>
<tag-desc>
<link id="root">root</link> directive's value
for the current request, with all symbolic links resolved to real paths
</tag-desc>
<tag-name><var>$request_filename</var></tag-name>
<tag-desc>
file path for the current query, based on the
<link id="root">root</link> and <link id="alias">alias</link>
directives, and the request URI
</tag-desc>
<tag-name><var>$request_body</var></tag-name>
<tag-desc>
request body
<para>
The variable's value is made available in locations
processed by the
<link doc="ngx_http_proxy_module.xml" id="proxy_pass">proxy_pass</link>
and
<link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass">fastcgi_pass</link>
directives.
</para>
</tag-desc>
<tag-name><var>$request_body_file</var></tag-name>
<tag-desc>
name of a temporary file with the request body
<para>
At the end of processing, the file needs to be removed.
To always write a request body to a file,
<link id="client_body_in_file_only">client_body_in_file_only on</link>
needs be specified.
When passing the name of a temporary file in a proxied request,
or in a request to a FastCGI server,
passing of the request body should be disabled by the
<link doc="ngx_http_proxy_module.xml"
id="proxy_pass_request_body">proxy_pass_request_body</link>
and
<link doc="ngx_http_fastcgi_module.xml"
id="fastcgi_pass_request_body">fastcgi_pass_request_body</link>
directives, respectively.
</para>
</tag-desc>
<tag-name><var>$request_uri</var></tag-name>
<tag-desc>
full original request URI (with arguments)
</tag-desc>
<tag-name><var>$query_string</var></tag-name>
<tag-desc>
same as <var>$args</var>
</tag-desc>
<tag-name><var>$scheme</var></tag-name>
<tag-desc>
request scheme, <dq><code>http</code></dq> or <dq><code>https</code>></dq>
</tag-desc>
<tag-name><var>$server_protocol</var></tag-name>
<tag-desc>
request protocol, usually
<dq><code>HTTP/1.0</code></dq>
or
<dq><code>HTTP/1.1</code></dq>
</tag-desc>
<tag-name><var>$server_addr</var></tag-name>
<tag-desc>
an address of the server which accepted a request
<para>
Computing a value of this variable usually requires one system call.
To avoid a system call, the <command>listen</command> directives
must specify addresses and use the <parameter>bind</parameter> parameter
</para>
</tag-desc>
<tag-name><var>$server_name</var></tag-name>
<tag-desc>
name of the server which accepted a request
</tag-desc>
<tag-name><var>$server_port</var></tag-name>
<tag-desc>
port of the server which accepted a request
</tag-desc>
<tag-name><var>$uri</var></tag-name>
<tag-desc>
current URI in request
<para>
It may differ from an original, e.g. when doing internal redirects,
or when using index files.
</para>
</tag-desc>
</list>
</para>
</section>
</module> </module>

View File

@ -65,7 +65,7 @@ module;
<listitem> <listitem>
use of variables by worker processes. use of variables by worker processes.
Please bear in mind that controlling system libraries in this way Please bear in mind that controlling system libraries in this way
isn't always possible as it's not uncommon for libraries to check is not always possible as it is not uncommon for libraries to check
variables only during initialization, well before they can be set variables only during initialization, well before they can be set
using this directive. using this directive.
An exception from this is an above mentioned An exception from this is an above mentioned
@ -194,11 +194,11 @@ An internal implementation of interval depends on the method used:
<list type="bullet"> <list type="bullet">
<listitem> <listitem>
an <c-def>EVFILT_TIMER</c-def> filter if <code>kqueue</code> is used; an <c-def>EVFILT_TIMER</c-def> filter if <value>kqueue</value> is used;
</listitem> </listitem>
<listitem> <listitem>
<c-func>timer_create</c-func> if <code>eventport</code> is used; <c-func>timer_create</c-func> if <value>eventport</value> is used;
</listitem> </listitem>
<listitem> <listitem>
@ -281,7 +281,7 @@ Defines the number of worker processes.
<para> <para>
Defines a current working directory for a worker process. Defines a current working directory for a worker process.
It's primarily used for writing a core-file, in which case It is primarily used when writing a core-file, in which case
a working process should have write permission for the a working process should have write permission for the
specified directory. specified directory.
</para> </para>