annotate xml/cn/docs/http/ngx_http_core_module.xml @ 1017:9f9a427a73eb

Fixed broken links to chinese versions of some modules. The chinese version contains untranslated copies of english documentation for random_index and realip modules. The result is the appearance of 'translation to chinese' link for this modules pointing to non-existing document. This files are removed. Also, broken links are generated for the chinese version of the "flv" module, but the translation exists, although not enabled for publication. Since contents of file looks like a valid translation, it is allowed to be published.
author Vladimir Homutov <vl@nginx.com>
date Mon, 18 Nov 2013 12:48:10 +0400
parents ceb8a4e374b7
children ff357b676c2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
792
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1 <?xml version="1.0"?>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
3 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
4 Copyright (C) Igor Sysoev
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
5 Copyright (C) Nginx, Inc.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
6 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
7
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
9
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
10 <module name="ngx_http_core_module 模块"
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
11 link="/cn/docs/http/ngx_http_core_module.html"
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
12 lang="cn"
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
13 translator="cfsego"
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14 rev="13">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16 <section id="directives" name="指令">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
17
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
18 <directive name="aio">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
19 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
20 <literal>on</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
21 <literal>off</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
22 <literal>sendfile</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
23 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
24 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
25 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
26 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27 <appeared-in>0.8.11</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
28
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
29 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
30 在FreeBSD和Linux操作系统上启用或者禁用异步文件I/O(AIO)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 从FreeBSD 4.3版本开始,可以使用AIO。AIO既可以静态链接到内核中:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
35 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
36 options VFS_AIO
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
37 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
38 又可以作为内核模块动态加载:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
40 kldload aio
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
42 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
43
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
44 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45 在FreeBSD第5版和第6版,静态启动AIO,或者在系统启动时动态加载AIO,都会触发网络子系统使用一把大锁,进而对整个系统的性能造成负面影响。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
46 这个限制在2009年发布的FreeBSD 6.4稳定版和FreeBSD 7中被消除。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
47 虽然如此,仍有方法在5.3及以上版本的FreeBSD中开启AIO而不触发网络子系统的大锁,那就是在内核启动以后加载AIO模块。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
48 使用这种时,<path>/var/log/messages</path>中会出现下面信息,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
50 WARNING: Network stack Giant-free, but aio requires Giant.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
51 Consider adding 'options NET_WITH_GIANT' or setting debug.mpsafenet=0
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
52 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
53 但可以安全的忽略它。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
54 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
55 使用AIO大锁的是FreeBSD套接字上的<c-func>aio_read</c-func>和<c-func>aio_write</c-func>异步操作。但是nginx仅仅在磁盘I/O使用AIO,所以不会出现问题。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
56 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
57 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
58
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
59 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
60 为了让AIO工作,需要关闭<link id="sendfile"/>:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
61 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
62 location /video/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
63 sendfile off;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
64 aio on;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
65 output_buffers 1 64k;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
66 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
67 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
68 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
69
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
70 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
71 不过,从FreeBSD 5.2.1版和nginx 0.8.12版开始,AIO也可以为<c-func>sendfile</c-func>预读数据:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
72 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
73 location /video/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
74 sendfile on;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
75 tcp_nopush on;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
76 aio sendfile;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
77 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
78 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
79
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
80 这个配置使nginx在调用<c-func>sendfile</c-func>时带<c-def>SF_NODISKIO</c-def>参数,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
81 那么<c-func>sendfile</c-func>在数据没有读入内存的时候,就不会阻塞在磁盘I/O上,而是直接返回报告;接着nginx就读这个一字节报告,然后初始化异步数据。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
82 FreeBSD内核接着会读取文件的开始128K字节到内存,而后续的读取只会以16K的单位来进行。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
83 这个性质可以使用<link id="read_ahead"/>指令来调节。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
84 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
85
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
86 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
87 从Linux内核2.6.22版开始,也可以使用AIO。但必须同时开启<link id="directio"/>,否则读取将是阻塞的:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
88 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
89 location /video/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
90 aio on;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
91 directio 512;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
92 output_buffers 1 128k;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
93 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
94 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
95 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
96
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
97 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
98 在Linux上,<link id="directio"/>只在读取的块的边界对齐512字节(在XFS上是4K字节)时才有用。在读取文件尾部时,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
99 如果没有对齐,AIO读取还是阻塞的。同样的情况(如果数据的开始或者结尾未对齐时,读取也是阻塞的)
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
100 也发生在含有<header>byte range</header>头的请求中,或者发生在不是从头开始的FLV请求中。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
101 没有必要手动关闭<link id="sendfile"/>,因为如果使用了<link id="directio"/>,它就会自动关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
102 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
103
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
104 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
105
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
106
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
107 <directive name="alias">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
108 <syntax><value>path</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
109 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
110 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
111
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
112 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
113 定义指定路径的替换路径。比如下面配置
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
114 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
115 location /i/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
116 alias /data/w3/images/;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
117 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
118 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
119 “<literal>/i/top.gif</literal>”将由<path>/data/w3/images/top.gif</path>文件来响应。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
120 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
121
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
122 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
123 <value>path</value>的值可以包含变量,但不能使用<var>$document_root</var>和<var>$realpath_root</var>这两个变量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
124 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
125
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
126 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
127 如果在定义了正则表达式的路径中使用了<literal>alias</literal>,那么正则表达式中应该含有匹配组,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
128 并且<literal>alias</literal>应该引用这些匹配组(0.7.40版)来组成一个完整的文件路径,比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
129 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
130 location ~ ^/users/(.+\.(?:gif|jpe?g|png))$ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
131 alias /data/w3/images/$1;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
132 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
133 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
134 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
135
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
136 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
137 如果路径对应指令<value>path</value>值的最后一部分:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
138 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
139 location /images/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
140 alias /data/w3/images/;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
141 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
142 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
143 最好换用<link id="root"/>指令:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
144 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
145 location /images/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
146 root /data/w3;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
147 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
148 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
149 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
150
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
151 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
152
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
153
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
154 <directive name="chunked_transfer_encoding">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
155 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
156 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
157 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
158 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
159 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
160
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
161 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
162 允许关闭HTTP/1.1中的分块传输编码。在客户端软件不支持分块传输编码的时候,这条指令才有用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
163 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
164
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
165 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
166
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
167
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
168 <directive name="client_body_buffer_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
169
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
170 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
171 <default>8k|16k</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
172 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
173 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
174 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
175
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
176 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
177 设置读取客户端请求正文的缓冲容量。如果请求正文大于缓冲容量,整个正文或者正文的一部分将写入<link id="client_body_temp_path">临时文件</link>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
178 缓冲大小默认等于两块内存页的大小,在x86平台、其他32位平台和x86-64平台,这个值是8K。在其他64位平台,这个值一般是16K。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
179 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
180
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
181 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
182
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
183
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
184 <directive name="client_body_in_file_only">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
185 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
186 <literal>on</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
187 <literal>clean</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
188 <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
189 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
190 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
191 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
192 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
193
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
194 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
195 决定nginx是否将客户端请求正文整个写入文件。这条指令在调试时,或者使用<var>$request_body_file</var>变量时,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
196 或者使用<link doc="ngx_http_perl_module.xml">ngx_http_perl_module</link>模块的
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
197 <link doc="ngx_http_perl_module.xml" id="methods">$r->request_body_file</link>方法时都可以使用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
198 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
199
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
200 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
201 当指令值设置为<literal>on</literal>时,请求处理结束后不会删除临时文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
202 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
203
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
204 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
205 当指令值设置为<literal>clean</literal>时,请求处理结束后会删除临时文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
206 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
207
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
208 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
209
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
210
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
211 <directive name="client_body_in_single_buffer">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
212 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
213 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
214 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
215 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
216 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
217
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
218 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
219 决定nginx将整个客户端请求正文保存在一块缓冲中。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
220 这条指令推荐在使用<var>$request_body</var>变量时使用,可以节省引入的拷贝操作。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
221 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
222
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
223 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
224
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
225
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
226 <directive name="client_body_temp_path">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
227 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
228 <value>path</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
229 [<value>level1</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
230 [<value>level2</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
231 [<value>level3</value>]]]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
232 <default>client_body_temp</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
233 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
234 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
235 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
236
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
237 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
238 定义存储客户端请求正文的临时文件的目录。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
239 支持在指定目录下多达3层的子目录结构。比如下面配置
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
240 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
241 client_body_temp_path /spool/nginx/client_temp 1 2;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
242 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
243 存储临时文件的路径是
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
244 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
245 /spool/nginx/client_temp/7/45/00000123457
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
246 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
247 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
248
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
249 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
250
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
251
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
252 <directive name="client_body_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
253 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
254 <default>60s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
255 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
256 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
257 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
258
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
259 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
260 定义读取客户端请求正文的超时。超时是指相邻两次读操作之间的最大时间间隔,而不是整个请求正文完成传输的最大时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
261 如果客户端在这段时间内没有传输任何数据,nginx将返回<http-status code="408" text="Request Time-out"/>错误到客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
262 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
263
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
264 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
265
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
266
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
267 <directive name="client_header_buffer_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
268 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
269 <default>1k</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
270 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
271 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
272
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
273 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
274 设置读取客户端请求头部的缓冲容量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
275 对于大多数请求,1K的缓冲足矣。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
276 但如果请求中含有的cookie很长,或者请求来自WAP的客户端,可能请求头不能放在1K的缓冲中。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
277 如果从请求行,或者某个请求头开始不能完整的放在这块空间中,那么nginx将按照
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
278 <link id="large_client_header_buffers"/>指令的配置分配更多更大的缓冲来存放。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
279 directive.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
280 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
281
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
282 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
283
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
284
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
285 <directive name="client_header_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
286 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
287 <default>60s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
288 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
289 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
290
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
291 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
292 定义读取客户端请求头部的超时。如果客户端在这段时间内没有传送完整的头部到nginx,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
293 nginx将返回错误<http-status code="408" text="Request Time-out"/>到客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
294 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
295
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
296 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
297
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
298
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
299 <directive name="client_max_body_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
300 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
301 <default>1m</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
302 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
303 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
304 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
305
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
306 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
307 设置允许客户端请求正文的最大长度。请求的长度由<header>Content-Length</header>请求头指定。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
308 如果请求的长度超过设定值,nginx将返回错误<http-status code="413" text="Request Entity Too Large"/>到客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
309 请注意<!--link doc="/web/upload.xml"-->浏览器不能正确显示这个错误<!--/link-->。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
310 将<value>size</value>设置成0可以使nginx不检查客户端请求正文的长度。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
311 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
312
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
313 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
314
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
315
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
316 <directive name="connection_pool_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
317 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
318 <default>256</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
319 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
320 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
321
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
322 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
323 允许微调为每个连接分配的内存。这条指令对nginx的性能影响非常小,一般不应该使用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
324 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
325
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
326 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
327
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
328
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
329 <directive name="default_type">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
330 <syntax><value>mime-type</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
331 <default>text/plain</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
332 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
333 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
334 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
335
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
336 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
337 定义响应的默认MIME类型。设置文件扩展名和响应的MIME类型的映射表则使用<link id="types"/>指令。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
338 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
339
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
340 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
341
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
342
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
343 <directive name="directio">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
344 <syntax><value>size</value> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
345 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
346 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
347 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
348 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
349 <appeared-in>0.7.7</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
350
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
351 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
352 当读入长度大于等于指定<value>size</value>的文件时,开启DirectIO功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
353 具体的做法是,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
354 在FreeBSD或Linux系统开启使用<c-def>O_DIRECT</c-def>标志,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
355 在Mac OS X系统开启使用<c-def>F_NOCACHE</c-def>标志,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
356 在Solaris系统开启使用<c-func>directio</c-func>功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
357 这条指令自动关闭<link id="sendfile"/>(0.7.15版)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
358 它在处理大文件时
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
359 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
360 directio 4m;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
361 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
362 或者在Linux系统使用<link id="aio"/>时比较有用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
363 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
364
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
365 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
366
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
367
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
368 <directive name="directio_alignment">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
369 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
370 <default>512</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
371 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
372 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
373 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
374 <appeared-in>0.8.11</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
375
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
376 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
377 为<link id="directio"/>设置文件偏移量对齐。大多数情况下,按512字节对齐足矣,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
378 但在Linux系统下使用XFS,需要将值扩大到4K。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
379 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
380
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
381 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
382
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
383
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
384 <directive name="disable_symlinks">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
385 <syntax><literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
386 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
387 <literal>on</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
388 <literal>if_not_owner</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
389 [<literal>from</literal>=<value>part</value>]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
390 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
391 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
392 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
393 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
394 <appeared-in>1.1.15</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
395
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
396 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
397 决定nginx打开文件时如何处理符号链接:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
398 <list type="tag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
399
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
400 <tag-name><literal>off</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
401 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
402 默认行为,允许路径中出现符号链接,不做检查。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
403 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
404
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
405 <tag-name><literal>on</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
406 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
407 如果文件路径中任何组成部分中含有符号链接,拒绝访问该文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
408 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
409
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
410 <tag-name><literal>if_not_owner</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
411 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
412 如果文件路径中任何组成部分中含有符号链接,且符号链接和链接目标的所有者不同,拒绝访问该文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
413 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
414
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
415 <tag-name><literal>from</literal>=<value>part</value></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
416 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
417 当nginx进行符号链接检查时(参数<literal>on</literal>和参数<literal>if_not_owner</literal>),路径中所有部分默认都会被检查。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
418 而使用<literal>from</literal>=<value>part</value>参数可以避免对路径开始部分进行符号链接检查,而只检查后面的部分路径。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
419 如果某路径不是以指定值开始,整个路径将被检查,就如同没有指定这个参数一样。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
420 如果某路径与指定值完全匹配,将不做检查。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
421 这个参数的值可以包含变量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
422 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
423
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
424 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
425 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
426
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
427 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
428 比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
429 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
430 disable_symlinks on from=$document_root;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
431 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
432 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
433
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
434 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
435 这条指令只在有<c-func>openat</c-func>和<c-func>fstatat</c-func>接口的系统上可用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
436 当然,现在的FreeBSD、Linux和Solaris都支持这些接口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
437 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
438
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
439 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
440 参数<literal>on</literal>和<literal>if_not_owner</literal>会带来处理开销。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
441 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
442 只在那些不支持打开目录查找文件的系统中,使用这些参数需要工作进程有这些被检查目录的读权限。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
443 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
444 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
445
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
446 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
447 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
448 <link doc="ngx_http_autoindex_module.xml">ngx_http_autoindex_module</link>模块,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
449 <link doc="ngx_http_random_index_module.xml">ngx_http_random_index_module</link>模块
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
450 和<link doc="ngx_http_dav_module.xml">ngx_http_dav_module</link>模块目前忽略这条指令。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
451 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
452 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
453
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
454 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
455
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
456
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
457 <directive name="error_page">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
458 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
459 <value>code</value> ...
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
460 [<literal>=</literal>[<value>response</value>]]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
461 <value>uri</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
462 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
463 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
464 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
465 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
466 <context>if in location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
467
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
468 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
469 为指令错误定义显示的URI。当前配置级别没有<literal>error_page</literal>指令时,将从上层配置继承。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
470 <literal>uri</literal>可以包含变量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
471 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
472
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
473 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
474 比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
475 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
476 error_page 404 /404.html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
477 error_page 500 502 503 504 /50x.html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
478 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
479 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
480
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
481 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
482 而且,可以使用“<literal>=</literal><value>response</value>语法改变响应状态码。比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
483 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
484 error_page 404 =200 /empty.gif;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
485 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
486 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
487
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
488 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
489 如果URI将被发送到一个被代理的服务器处理,或者发送到一个FastCGI服务器处理,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
490 这些后端服务器又返回了不同的响应状态码(比如200、302、401或404),那么这些返回的状态码也可以由本指令处理:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
491 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
492 error_page 404 = /404.php;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
493 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
494 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
495
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
496 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
497 当然,也可以使用本指令对错误处理进行重定向:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
498 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
499 error_page 403 http://example.com/forbidden.html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
500 error_page 404 =301 http://example.com/notfound.html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
501 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
502 对于例子中的第一行,nginx将向客户端发送302响应状态码。这种用法能使用的状态码只有301、302、303和307。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
503 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
504
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
505 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
506 如果内部跳转时无需改变URI,可以将错误处理转到一个命名路径:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
507 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
508 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
509 error_page 404 = @fallback;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
510 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
511
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
512 location @fallback {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
513 proxy_pass http://backend;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
514 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
515 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
516 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
517
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
518 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
519 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
520 如果处理<literal>uri</literal>产生了错误,那么nginx将最后一次出错的HTTP响应状态码返回给客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
521 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
522 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
523
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
524 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
525
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
526
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
527 <directive name="etag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
528 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
529 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
530 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
531 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
532 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
533 <appeared-in>1.3.3</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
534
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
535 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
536 开启或关闭为静态文件自动计算<header>ETag</header>响应头。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
537 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
538
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
539 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
540
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
541
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
542 <directive name="http">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
543 <syntax block="yes"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
544 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
545 <context>main</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
546 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
547 为HTTP服务器提供配置上下文。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
548 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
549 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
550
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
551
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
552 <directive name="if_modified_since">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
553 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
554 <literal>off</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
555 <literal>exact</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
556 <literal>before</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
557 <default>exact</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
558 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
559 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
560 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
561 <appeared-in>0.7.24</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
562
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
563 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
564 指定响应的修改时间和<header>If-Modified-Since</header>请求头的比较方法:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
565
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
566 <list type="tag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
567
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
568 <tag-name><literal>off</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
569 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
570 忽略<header>If-Modified-Since</header>请求头(0.7.34);
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
571 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
572
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
573 <tag-name><literal>exact</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
574 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
575 精确匹配;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
576 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
577
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
578 <tag-name><literal>before</literal></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
579 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
580 响应的修改时间小于等于<header>If-Modified-Since</header>请求头指定的时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
581 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
582
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
583 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
584 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
585
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
586 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
587
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
588
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
589 <directive name="ignore_invalid_headers">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
590 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
591 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
592 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
593 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
594
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
595 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
596 控制是否忽略非法的请求头字段名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
597 合法的名字是由英文字母、数字和连字符组成,当然也可以包含下划线(由<link id="underscores_in_headers"/>指令控制)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
598 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
599
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
600 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
601 本指令可以在默认虚拟主机的<link id="server"/>配置层级中定义一次,那么这个值在监听在相同地址和端口的所有虚拟主机上都生效。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
602 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
603
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
604 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
605
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
606
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
607 <directive name="internal">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
608 <syntax/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
609 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
610 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
611
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
612 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
613 指定一个路径是否只能用于内部访问。如果是外部访问,客户端将收到<http-status code="404" text="Not Found"/>错误。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
614 下列请求是内部请求:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
615
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
616 <list type="bullet">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
617
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
618 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
619 由<link id="error_page"/>指令、<link doc="ngx_http_index_module.xml" id="index"/>指令、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
620 <link doc="ngx_http_random_index_module.xml" id="random_index"/>指令
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
621 和<link id="try_files"/>指令引起的重定向请求;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
622 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
623
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
624 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
625 由后端服务器返回的<header>X-Accel-Redirect</header>响应头引起的重定向请求;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
626 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
627
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
628 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
629 由<link doc="ngx_http_ssi_module.xml">ngx_http_ssi_module</link>模块
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
630 和<link doc="ngx_http_addition_module.xml">ngx_http_addition_module</link>模块
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
631 的“<command>include virtual</command>”指令产生的子请求;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
632 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
633
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
634 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
635 用<link doc="ngx_http_rewrite_module.xml" id="rewrite"/>指令对请求进行修改。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
636 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
637
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
638 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
639 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
640
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
641 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
642 举例:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
643 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
644 error_page 404 /404.html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
645
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
646 location /404.html {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
647 internal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
648 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
649 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
650 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
651 nginx限制每个请求只能最多进行10次内部重定向,以防配置错误引起请求处理出现问题。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
652 如果内部重定向次数已达到10次,nginx将返回<http-status code="500" text="Internal Server Error"/>错误。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
653 同时,错误日志中将有“rewrite or internal redirection cycle”的信息。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
654 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
655 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
656
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
657 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
658
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
659
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
660 <directive name="keepalive_disable">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
661 <syntax><literal>none</literal> | <value>browser</value> ...</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
662 <default>msie6</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
663 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
664 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
665 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
666
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
667 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
668 针对行为异常的浏览器关闭长连接功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
669 <value>browser</value>参数指定那些浏览器会受到影响。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
670 值为<literal>msie6</literal>表示在遇到POST请求时,关闭与老版MSIE浏览器建立长连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
671 值为<literal>safari</literal>表示在遇到Mac OS X和类Mac OS X操作系统下的Safari浏览器和类Safari浏览器时,不与浏览器建立长连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
672 值为<literal>none</literal>表示为所有浏览器开启长连接功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
673 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
674 在nginx 1.1.18版本及以前,<literal>safari</literal>将匹配所有操作系统上的Safari和类Safari浏览器,并默认不与这些浏览器建立长连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
675 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
676 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
677
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
678 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
679
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
680
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
681 <directive name="keepalive_requests">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
682 <syntax><value>number</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
683 <default>100</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
684 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
685 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
686 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
687 <appeared-in>0.8.0</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
688
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
689 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
690 设置通过一个长连接可以处理的最大请求数。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
691 请求数超过此值,长连接将关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
692 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
693
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
694 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
695
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
696
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
697 <directive name="keepalive_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
698 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
699 <value>timeout</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
700 [<value>header_timeout</value>]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
701 <default>75s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
702 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
703 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
704 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
705
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
706 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
707 第一个参数设置客户端的长连接在服务器端保持的最长时间(在此时间客户端未发起新请求,则长连接关闭)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
708 第二个参数为可选项,设置<header>Keep-Alive: timeout=<value>time</value></header>响应头的值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
709 可以为这两个参数设置不同的值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
710 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
711
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
712 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
713 <header>Keep-Alive: timeout=<value>time</value></header>响应头可以被Mozilla和Konqueror浏览器识别和处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
714 MSIE浏览器在大约60秒后会关闭长连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
715 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
716
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
717 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
718
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
719
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
720 <directive name="large_client_header_buffers">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
721 <syntax><value>number</value> <value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
722 <default>4 8k</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
723 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
724 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
725
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
726 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
727 设置读取客户端请求超大请求的缓冲最大<value>number(数量)</value>和每块缓冲的<value>size(容量)</value>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
728 HTTP请求行的长度不能超过一块缓冲的容量,否则nginx返回错误<http-status code="414" text="Request-URI Too Large"/>到客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
729 每个请求头的长度也不能超过一块缓冲的容量,否则nginx返回错误<http-status code="400" text="Bad Request"/>到客户端。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
730 缓冲仅在必需是才分配,默认每块的容量是8K字节。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
731 即使nginx处理完请求后与客户端保持入长连接,nginx也会释放这些缓冲。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
732 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
733
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
734 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
735
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
736
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
737 <directive name="limit_except">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
738 <syntax block="yes"><value>method</value> ...</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
739 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
740 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
741
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
742 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
743 允许按请求的HTTP方法限制对某路径的请求。<value>method</value>用于指定不由这些限制条件进行过滤的HTTP方法,可选值有
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
744 <literal>GET</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
745 <literal>HEAD</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
746 <literal>POST</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
747 <literal>PUT</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
748 <literal>DELETE</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
749 <literal>MKCOL</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
750 <literal>COPY</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
751 <literal>MOVE</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
752 <literal>OPTIONS</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
753 <literal>PROPFIND</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
754 <literal>PROPPATCH</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
755 <literal>LOCK</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
756 <literal>UNLOCK</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
757 或者
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
758 <literal>PATCH</literal>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
759 指定<value>method</value>为<literal>GET</literal>方法的同时,nginx会自动添加<literal>HEAD</literal>方法。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
760 那么其他HTTP方法的请求就会由指令引导的配置块中的<link doc="ngx_http_access_module.xml">ngx_http_access_module</link>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
761 模块和<link doc="ngx_http_auth_basic_module.xml">ngx_http_auth_basic_module</link>模块的指令来限制访问。如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
762 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
763 limit_except GET {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
764 allow 192.168.1.0/32;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
765 deny all;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
766 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
767 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
768 请留意上面的例子将对<emphasis>除</emphasis>GET和HEAD方法以外的所有HTTP方法的请求进行访问限制。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
769 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
770
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
771 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
772
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
773
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
774 <directive name="limit_rate">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
775 <syntax><value>rate</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
776 <default>0</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
777 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
778 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
779 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
780 <context>if in location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
781
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
782 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
783 限制向客户端传送响应的速率限制。参数<value>rate</value>的单位是字节/秒,设置为0将关闭限速。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
784 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
785 速率越小,限速越精确。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
786 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
787 nginx按连接限速,所以如果某个客户端同时开启了两个连接,那么客户端的整体速率是这条指令设置值的2倍。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
788 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
789
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
790 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
791 也可以利用<var>$limit_rate</var>变量设置流量限制。如果想在特定条件下限制响应传输速率,可以使用这个功能:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
792 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
793 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
794
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
795 if ($slow) {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
796 set $limit_rate 4k;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
797 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
798
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
799 ...
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
800 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
801 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
802 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
803
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
804 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
805 此外,也可以通过<header>X-Accel-Limit-Rate</header>响应头来完成速率限制。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
806 这种机制可以用<link doc="ngx_http_proxy_module.xml" id="proxy_ignore_headers"/>指令和
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
807 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_ignore_headers"/>指令关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
808 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
809
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
810 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
811
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
812
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
813 <directive name="limit_rate_after">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
814 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
815 <default>0</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
816 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
817 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
818 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
819 <context>if in location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
820 <appeared-in>0.8.0</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
821
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
822 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
823 设置不限速传输的响应大小。当传输量大于此值时,超出部分将限速传送。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
824 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
825
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
826 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
827 比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
828 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
829 location /flv/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
830 flv;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
831 limit_rate_after 500k;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
832 limit_rate 50k;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
833 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
834 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
835 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
836
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
837 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
838
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
839
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
840 <directive name="lingering_close">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
841 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
842 <literal>off</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
843 <literal>on</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
844 <literal>always</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
845 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
846 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
847 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
848 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
849 <appeared-in>1.1.0</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
850 <appeared-in>1.0.6</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
851
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
852 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
853 控制nginx如何关闭客户端连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
854 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
855
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
856 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
857 默认值“<literal>on</literal>”指示nginx在完成关闭连接前<link id="lingering_timeout">等待</link>和
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
858 <link id="lingering_time">处理</link>客户端发来的额外数据。但只有在预测客户端可能发送更多数据的情况才会做此处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
859 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
860
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
861 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
862 “<literal>always</literal>”指示nginx无条件等待和处理客户端的额外数据。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
863 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
864
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
865 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
866 “<literal>off</literal>”指示nginx立即关闭连接,而绝不等待客户端传送额外数据。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
867 这样做破坏了协议,所以正常条件下不应使用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
868 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
869
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
870 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
871
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
872
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
873 <directive name="lingering_time">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
874 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
875 <default>30s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
876 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
877 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
878 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
879
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
880 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
881 <link id="lingering_close"/>生效时,这条指令定义nginx处理(读取但忽略)客户端额外数据的最长时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
882 超过这段时间后,nginx将关闭连接,不论是否还有更多数据待处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
883 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
884
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
885 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
886
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
887
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
888 <directive name="lingering_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
889 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
890 <default>5s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
891 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
892 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
893 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
894
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
895 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
896 <link id="lingering_close"/>生效时,这条指令定义nginx等待客户端更多数据到来的最长时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
897 如果在这段时间内,nginx没有接收到数据,nginx将关闭连接。否则,nginx将接收数据,忽略它,然后再等待更多数据。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
898 这个“等待——接收——忽略”的循环一直重复,但总时间不会超过<link id="lingering_time"/>指令定义的时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
899 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
900
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
901 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
902
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
903
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
904 <directive name="listen">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
905 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
906 <value>address</value>[:<value>port</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
907 [<literal>default_server</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
908 [<literal>setfib</literal>=<value>number</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
909 [<literal>backlog</literal>=<value>number</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
910 [<literal>rcvbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
911 [<literal>sndbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
912 [<literal>accept_filter</literal>=<value>filter</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
913 [<literal>deferred</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
914 [<literal>bind</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
915 [<literal>ipv6only</literal>=<literal>on</literal>|<literal>off</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
916 [<literal>ssl</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
917 [<literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
918 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
919 <value>port</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
920 [<literal>default_server</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
921 [<literal>setfib</literal>=<value>number</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
922 [<literal>backlog</literal>=<value>number</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
923 [<literal>rcvbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
924 [<literal>sndbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
925 [<literal>accept_filter</literal>=<value>filter</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
926 [<literal>deferred</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
927 [<literal>bind</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
928 [<literal>ipv6only</literal>=<literal>on</literal>|<literal>off</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
929 [<literal>ssl</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
930 [<literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
931 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
932 <literal>unix:</literal><value>path</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
933 [<literal>default_server</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
934 [<literal>backlog</literal>=<value>number</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
935 [<literal>rcvbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
936 [<literal>sndbuf</literal>=<value>size</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
937 [<literal>accept_filter</literal>=<value>filter</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
938 [<literal>deferred</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
939 [<literal>bind</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
940 [<literal>ssl</literal>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
941 [<literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
942 <default>*:80 | *:8000</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
943 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
944
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
945 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
946 设置nginx监听地址,nginx从这里接受请求。对于IP协议,这个地址就是<value>address</value>和<value>port</value>;对于UNIX域套接字协议,这个地址就是<value>path</value>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
947 一条listen指令只能指定一个<value>address</value>或者<value>port</value>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
948 <value>address</value>也可以是主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
949 比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
950 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
951 listen 127.0.0.1:8000;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
952 listen 127.0.0.1;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
953 listen 8000;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
954 listen *:8000;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
955 listen localhost:8000;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
956 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
957 IPv6地址(0.7.36版)用方括号来表示:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
958 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
959 listen [::]:8000;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
960 listen [fe80::1];
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
961 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
962 UNIX域套接字(0.8.21版)则使用“<literal>unix:</literal>”前缀:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
963 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
964 listen unix:/var/run/nginx.sock;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
965 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
966 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
967
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
968 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
969 如果只定义了<value>address</value>,nginx将使用80端口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
970 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
971
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
972 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
973 在没有定义listen指令的情况下,如果以超级用户权限运行nginx,它将监听<literal>*:80</literal>,否则他将监听<literal>*:8000</literal>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
974 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
975
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
976 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
977 如果listen指令携带<literal>default_server</literal>参数,当前虚拟主机将成为指定<value>address</value>:<value>port</value>的默认虚拟主机。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
978 如果任何listen指令都没有携带<literal>default_server</literal>参数,那么第一个监听<value>address</value>:<value>port</value>的虚拟主机将被作为这个地址的默认虚拟主机。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
979 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
980 0.8.21版以前,这个参数的名称是<literal>default</literal>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
981 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
982 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
983
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
984 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
985 可以为<literal>listen</literal>指令定义若干额外的参数,这些参数用于套接字相关的系统调用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
986 这些参数可以在任何<literal>listen</literal>指令中指定,但是对于每个<value>address</value>:<value>port</value>,只能定义一次。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
987 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
988 0.8.21版以前,只有为<literal>listen</literal>指令定义了<literal>default</literal>参数,才能定义这些额外的参数。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
989 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
990 <list type="tag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
991
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
992 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
993 <literal>setfib</literal>=<value>number</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
994 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
995 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
996 这个参数(0.8.44)为监听套接字设置关联路由表FIB(<c-def>SO_SETFIB</c-def>选项)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
997 当前这个参数仅工作在FreeBSD上。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
998 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
999
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1000 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1001 <literal>backlog</literal>=<value>number</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1002 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1003 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1004 为系统调用<c-func>listen</c-func>设置<literal>backlog</literal>参数,用以限制未接受(Accept)连接的队列的最大长度。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1005 FreeBSD和Mac OS X下,<literal>backlog</literal>的默认值是-1,在其他系统中,默认值是511。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1006 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1007
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1008
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1009 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1010 <literal>rcvbuf</literal>=<value>size</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1011 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1012 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1013 为监听套接字设置接收缓冲区大小(<c-def>SO_RCVBUF</c-def>参数)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1014 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1015
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1016 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1017 <literal>sndbuf</literal>=<value>size</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1018 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1019 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1020 为监听套接字设置发送缓冲区大小(<c-def>SO_SNDBUF</c-def>参数)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1021 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1022
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1023 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1024 <literal>accept_filter</literal>=<value>filter</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1025 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1026 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1027 为监听套接字设置接受过滤器的名称(<c-def>SO_ACCEPTFILTER</c-def>选项)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1028 对每个到来的连接,接受过滤器先进行过滤,然后才将它们呈现给<c-func>accept</c-func>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1029 本特性仅工作在FreeBSD系统和NetBSD 5.0+系统下。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1030 可接受的值是
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1031 <link url="http://man.freebsd.org/accf_data">dataready</link>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1032
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1033 <link url="http://man.freebsd.org/accf_http">httpready</link>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1034 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1035
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1036 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1037 <literal>deferred</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1038 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1039 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1040 指示在Linux系统使用延迟的<c-func>accept</c-func>(<c-def>TCP_DEFER_ACCEPT</c-def>选项)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1041 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1042
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1043 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1044 <literal>bind</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1045 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1046 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1047 指示nginx为设置的<value>address</value>:<value>port</value>单独调用一次<c-func>bind</c-func>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1048 这是因为当有多条<literal>listen</literal>指令监听不同地址下的相同端口,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1049 而其中一条<literal>listen</literal>指令监听了这个端口的所有地址(<literal>*:</literal><value>port</value>)时,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1050 nginx只会为<literal>*:</literal><value>port</value>调用一次<c-func>bind</c-func>绑定套接字。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1051 需要留意的是,这种情况下,nginx会调用<c-func>getsockname</c-func>系统调用来确定接受请求的套接字地址。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1052 如果为某个<value>address</value>:<value>port</value>定义了参数<literal>backlog</literal>、<literal>rcvbuf</literal>、
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1053 <literal>sndbuf</literal>、<literal>accept_filter</literal>、<literal>deferred</literal>或者<literal>so_keepalive</literal>,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1054 nginx总会为这个地址单独调用一次<c-func>bind</c-func>绑定套接字。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1055 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1056
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1057 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1058 <literal>ipv6only</literal>=<literal>on</literal>|<literal>off</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1059 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1060 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1061 这个参数(0.7.42)(通过<c-def>IPV6_V6ONLY</c-def>选项)决定监听在通配地址<literal>[::]</literal>上的IPv6套接字是只支持IPv6连接,还是同时支持IPv6和IPv4连接。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1062 这个参数默认打开,并且只能在nginx启动时设置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1063 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1064 在1.3.4版以前,如果省略此参数,那么操作系统的套接字设置将生效。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1065 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1066 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1067
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1068 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1069 <literal>ssl</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1070 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1071 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1072 本参数(0.7.14)与套接字相关的系统调用无关,但是它可以指定从这个端口接受的连接应该以SSL模式工作。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1073 本参数在某服务器同时处理HTTP和HTTPS请求时,可以使<link doc="configuring_https_servers.xml" id="single_http_https_server">配置</link>更为紧凑。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1074 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1075 listen 80;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1076 listen 443 ssl;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1077 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1078 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1079
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1080 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1081 <literal>so_keepalive</literal>=<literal>on</literal>|<literal>off</literal>|[<value>keepidle</value>]:[<value>keepintvl</value>]:[<value>keepcnt</value>]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1082 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1083 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1084 这个参数(1.1.11)为监听套接字配置“TCP keepalive”行为。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1085 如果省略此参数,操作系统默认的设置将对此端口生效。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1086 如果参数值设置为“<literal>on</literal>”,监听套接字的<c-def>SO_KEEPALIVE</c-def>属性将被开启。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1087 如果参数值设置为“<literal>off</literal>”,监听套接字的<c-def>SO_KEEPALIVE</c-def>属性将被关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1088 有些操作系统支持为每个连接调整TCP长连接的参数。调整参数可以使用套接字选项<c-def>TCP_KEEPIDLE</c-def>,<c-def>TCP_KEEPINTVL</c-def>和<c-def>TCP_KEEPCNT</c-def>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1089 在这些操作系统上(当前就是Linux 2.4+,嬀NetBSD 5+FreeBSD 9.0-STABLE),可以使用<value>keepidle</value>,<value>keepintvl</value>和<value>keepcnt</value>参数来配置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1090 省略一到两个参数的话,对应套接字属性的系统默认设置将生效。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1091 比如,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1092 <example>so_keepalive=30m::10</example>将
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1093 设置空闲超时(<c-def>TCP_KEEPIDLE</c-def>)为30分钟,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1094 设置探测次数(<c-def>TCP_KEEPCNT</c-def>)为10次,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1095 保留探测时间间隔(<c-def>TCP_KEEPINTVL</c-def>)为系统默认值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1096 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1097
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1098 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1099 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1100
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1101 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1102 举例:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1103 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1104 listen 127.0.0.1 default_server accept_filter=dataready backlog=1024;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1105 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1106 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1107
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1108 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1109
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1110
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1111 <directive name="location">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1112 <syntax block="yes">[
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1113 <literal>=</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1114 <literal>~</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1115 <literal>~*</literal> |
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1116 <literal>^~</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1117 ] <value>uri</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1118 <syntax block="yes"><literal>@</literal><value>name</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1119 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1120 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1121 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1122
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1123 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1124 为某个请求URI(路径)建立配置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1125 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1126
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1127 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1128 路径匹配在URI规范化以后进行。所谓规范化,就是先将URI中形如“<literal>%XX</literal>”的编码字符进行解码,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1129 再解析URI中的相对路径“<literal>.</literal>”和“<literal>..</literal>”部分,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1130 另外还可能会<link id="merge_slashes">压缩</link>相邻的两个或多个斜线成为一个斜线。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1131 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1132
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1133 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1134 可以使用前缀字符串或者正则表达式定义路径。使用正则表达式需要在路径开始添加“<literal>~*</literal>”前缀
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1135 (不区分大小写),或者“<literal>~</literal>”前缀(区分大小写)。为了根据请求URI查找路径,nginx先检查前缀字符串定义的路径
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1136 (前缀路径),在这些路径中找到能最精确匹配请求URI的路径。然后nginx按在配置文件中的出现顺序检查正则表达式路径,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1137 匹配上某个路径后即停止匹配并使用该路径的配置,否则使用最大前缀匹配的路径的配置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1138 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1139
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1140 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1141 路径可以嵌套,但有例外,后面将提到。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1142 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1143
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1144 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1145 在不区分大小写的操作系统(诸如Mac OS X和Cygwin)上,前缀匹配忽略大小写(0.7.7)。但是,比较仅限于单字节的编码区域(one-byte locale)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1146 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1147
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1148 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1149 正则表达式中可以包含匹配组(0.7.40),结果可以被后面的其他指令使用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1150 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1151
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1152 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1153 如果最大前缀匹配的路径以“<literal>^~</literal>”开始,那么nginx不再检查正则表达式。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1154 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1155
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1156 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1157 而且,使用“<literal>=</literal>”前缀可以定义URI和路径的精确匹配。如果发现匹配,则终止路径查找。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1158 比如,如果请求“<literal>/</literal>”出现频繁,定义“<literal>location = /</literal>”可以提高这些请求的处理速度,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1159 因为查找过程在第一次比较以后即结束。这样的路径明显不可能包含嵌套路径。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1160 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1161
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1162 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1163 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1164 在0.7.1到0.8.41的所有nginx中,如果请求匹配的前缀字符串路径并没有“<literal>=</literal>”或“<literal>^~</literal>”前缀,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1165 路径查找过程仍然会停止,而不进行正则表达式匹配。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1166 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1167 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1168
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1169 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1170 让我们用一个例子解释上面的说法:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1171 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1172 location = / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1173 [ configuration A ]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1174 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1175
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1176 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1177 [ configuration B ]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1178 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1179
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1180 location /documents/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1181 [ configuration C ]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1182 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1183
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1184 location ^~ /images/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1185 [ configuration D ]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1186 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1187
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1188 location ~* \.(gif|jpg|jpeg)$ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1189 [ configuration E ]
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1190 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1191 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1192 请求“<literal>/</literal>”匹配配置A,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1193 请求“<literal>/index.html</literal>”匹配配置B,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1194 请求“<literal>/documents/document.html</literal>”匹配配置C,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1195 请求“<literal>/images/1.gif</literal>”匹配配置D,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1196 请求“<literal>/documents/1.jpg</literal>”匹配配置E。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1197 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1198
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1199 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1200 前缀“<literal>@</literal>”定义了命名路径。这种路径不在一般的请求处理中使用,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1201 而是用在请求重定向中。这些路径不能嵌套,也不能包含嵌套路径。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1202 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1203
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1204 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1205 <migration from="Apache" directive="Location" />
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1206 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1207
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1208 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1209
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1210
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1211 <directive name="log_not_found">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1212 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1213 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1214 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1215 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1216 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1217
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1218 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1219 开启或者关闭在<link doc="../ngx_core_module.xml" id="error_log"/>中记录文件不存在的错误。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1220 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1221
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1222 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1223
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1224
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1225 <directive name="log_subrequest">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1226 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1227 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1228 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1229 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1230 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1231
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1232 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1233 开启或者关闭在<link doc="ngx_http_log_module.xml" id="access_log"/>中记录子请求的访问日志。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1234 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1235
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1236 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1237
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1238
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1239 <directive name="max_ranges">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1240 <syntax><value>number</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1241 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1242 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1243 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1244 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1245 <appeared-in>1.1.2</appeared-in>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1246
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1247 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1248 如果请求中含有字节范围的请求头,这条指令可以限制此范围允许的最大值。如果请求头的值超过此限制,将按请求未携带此请求头的情况处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1249 默认nginx对此不做限制。设置为0将使nginx完全不支持HTTP字节范围特性。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1250 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1251
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1252 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1253
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1254
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1255 <directive name="merge_slashes">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1256 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1257 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1258 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1259 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1260
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1261 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1262 开启或者关闭将请求URI中相邻两个或更多斜线合并成一个的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1263 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1264
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1265 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1266 注意压缩URI对于前缀匹配和正则匹配的正确性是很重要的。没有开启这个功能时,请求“<literal>//scripts/one.php</literal>”将不能匹配
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1267 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1268 location /scripts/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1269 ...
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1270 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1271 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1272 而被按静态文件的流程处理,所以将它变换成“<literal>/scripts/one.php</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1273 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1274
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1275 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1276 如果URI中包含base64编码的内容,必须将斜线压缩调整成<literal>off</literal>,因为base64编码本身会使用“<literal>/</literal>”字符。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1277 然而。出于安全方面的考虑,最好还是不要关闭压缩。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1278 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1279
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1280 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1281 这条指令可以指定在默认虚拟主机的<link id="server"/>配置级别。这样的话,这个配置可以覆盖监听同一地址和端口的所有虚拟主机。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1282 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1283
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1284 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1285
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1286
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1287 <directive name="msie_padding">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1288 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1289 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1290 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1291 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1292 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1293
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1294 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1295 在响应状态码大于等于400时,在响应正文中添加一段注释,使响应正文达到512字节。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1296 本指令可以为MSIE客户端开启或关闭这个功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1297 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1298
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1299 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1300
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1301
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1302 <directive name="msie_refresh">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1303 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1304 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1305 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1306 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1307 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1308
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1309 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1310 为MSIE客户端开启或者关闭用页面刷新取代页面重定向的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1311 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1312
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1313 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1314
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1315
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1316 <directive name="open_file_cache">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1317 <syntax><literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1318 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1319 <literal>max</literal>=<value>N</value>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1320 [<literal>inactive</literal>=<value>time</value>]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1321 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1322 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1323 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1324 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1325
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1326 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1327 用于配置文件缓存,可缓存:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1328 <list type="bullet">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1329
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1330 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1331 打开文件的描述符,大小和修改时间;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1332 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1333
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1334 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1335 目录查找结果;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1336 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1337
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1338 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1339 文件查找时的错误结果,诸如“file not found”(文件不存在)、“no read permission”(无读权限)等等。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1340 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1341 应单独使用<link id="open_file_cache_errors"/>指令开启缓存错误结果的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1342 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1343 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1344
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1345 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1346 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1347
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1348 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1349 指令有下列参数:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1350 <list type="tag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1351
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1352 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1353 <literal>max</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1354 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1355 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1356 设置缓存中元素的最大数量,当缓存溢出时,使用LRU(最近最少使用)算法删除缓存中的元素;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1357 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1358
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1359 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1360 <literal>inactive</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1361 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1362 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1363 设置超时,在这段时间内缓存元素如果没有被访问,将从缓存中删除。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1364 默认超时是60秒;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1365 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1366
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1367 <tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1368 <literal>off</literal>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1369 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1370 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1371 关闭缓存。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1372 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1373
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1374 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1375 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1376
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1377 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1378 举例:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1379 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1380 open_file_cache max=1000 inactive=20s;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1381 open_file_cache_valid 30s;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1382 open_file_cache_min_uses 2;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1383 open_file_cache_errors on;<!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1384 open_file_cache_events on;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1385 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1386 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1387 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1388
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1389 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1390
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1391
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1392 <directive name="open_file_cache_errors">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1393 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1394 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1395 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1396 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1397 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1398
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1399 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1400 开启或者关闭<link id="open_file_cache">缓存文件</link>查找的错误结果。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1401 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1402
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1403 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1404
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1405
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1406 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1407
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1408 <directive name="open_file_cache_events">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1409 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1410 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1411 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1412 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1413 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1414
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1415 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1416 Enables to use kernel events to validate
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1417 <link id="open_file_cache"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1418 elements.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1419 This directive works with the
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1420 <link doc="../events.xml" id="kqueue"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1421 method only.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1422 Note that only NetBSD&nbsp;2.0+ and FreeBSD&nbsp;6.0+
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1423 support events for arbitrary file system types.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1424 Other operating systems support events only for essential
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1425 file systems such as UFS or FFS.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1426 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1427
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1428 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1429
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1430 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1431
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1432
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1433 <directive name="open_file_cache_min_uses">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1434 <syntax><value>number</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1435 <default>1</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1436 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1437 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1438 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1439
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1440 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1441 设置在由<link id="open_file_cache"/>指令的<literal>inactive</literal>参数配置的超时时间内,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1442 文件应该被访问的最小<value>number(次数)</value>。如果访问次数大于等于此值,文件描述符会保留在缓存中,否则从缓存中删除。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1443 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1444
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1445 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1446
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1447
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1448 <directive name="open_file_cache_valid">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1449 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1450 <default>60s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1451 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1452 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1453 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1454
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1455 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1456 设置检查<link id="open_file_cache"/>缓存的元素的时间间隔。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1457 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1458 When
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1459 <link id="open_file_cache_events"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1460 is enabled, open file descriptors
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1461 are checked only once, and then updated right after they get changed.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1462 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1463 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1464
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1465 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1466
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1467
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1468 <directive name="optimize_server_names">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1469 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1470 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1471 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1472 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1473
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1474 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1475 这条指令已经被废弃,请使用<link id="server_name_in_redirect"/>指令。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1476 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1477
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1478 <!--
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1479 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1480 Enables or disables optimization of hostname checking in name-based
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1481 virtual servers.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1482 In particular, the checking affects hostnames used in redirects.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1483 If optimization is enabled, and all name-based servers listening on
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1484 the same address:port pair have identical configuration, then
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1485 names are not checked during request processing, and the first
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1486 server name is used in redirects.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1487 In case redirects should use hostnames sent by clients,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1488 optimization needs to be disabled.
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1489 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1490 -->
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1491
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1492 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1493
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1494
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1495 <directive name="port_in_redirect">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1496 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1497 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1498 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1499 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1500 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1501
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1502 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1503 开启或关闭nginx发起重定向时指定端口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1504 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1505
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1506 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1507 重定向中首要主机名的使用由<link id="server_name_in_redirect"/>指令控制。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1508 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1509
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1510 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1511
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1512
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1513 <directive name="postpone_output">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1514 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1515 <default>1460</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1516 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1517 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1518 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1519
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1520 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1521 如果可能,到客户端的数据将被推迟发送,直到nginx需要发送的数据至少有<value>size</value>字节。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1522 设置为0将关闭推迟发送的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1523 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1524
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1525 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1526
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1527
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1528 <directive name="read_ahead">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1529 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1530 <default>0</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1531 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1532 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1533 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1534
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1535 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1536 设置内核参数,控制文件预读的数量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1537 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1538
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1539 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1540 在Linux上,因为使用的是<literal>posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL)</literal>系统调用,所以<value>size</value>无用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1541 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1542
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1543 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1544 在FreeBSD上,访问的是<literal>fcntl(O_READAHEAD,</literal><value>size</value><literal>)</literal>系统调用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1545 该系统调用在FreeBSD&nbsp;9.0-CURRENT才被支持,在FreeBSD&nbsp;7上则需要<link url="http://sysoev.ru/freebsd/patch.readahead.txt">打补丁</link>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1546 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1547
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1548 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1549
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1550
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1551 <directive name="recursive_error_pages">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1552 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1553 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1554 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1555 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1556 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1557
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1558 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1559 允许或禁止<link id="error_page"/>指令进行多次重定向。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1560 允许的话,重定向次数也有<link id="internal">限制</link>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1561 而禁止此功能时,当访问<link id="error_page"/>指令重定向的错误页面出现任何问题时,nginx将直接输出默认错误页面。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1562 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1563
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1564 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1565
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1566
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1567 <directive name="request_pool_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1568 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1569 <default>4k</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1570 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1571 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1572
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1573 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1574 允许对每个请求的内存分配进行细调。这条指令对性能影响很小,通常情况下不应使用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1575 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1576
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1577 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1578
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1579
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1580 <directive name="reset_timedout_connection">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1581 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1582 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1583 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1584 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1585 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1586
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1587 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1588 开启或关闭重置超时连接的功能。重置连接是这样执行的:关闭套接字以前,设置<c-def>SO_LINGER</c-def>选项的超时值为0,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1589 那么当关闭套接字时,nginx向客户端发送TCP RST,并且释放此套接字占用的所有内存。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1590 这样可以避免某个已关闭的套接字长时间处于FIN_WAIT1状态,并占用内存缓冲区。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1591 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1592
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1593 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1594 应该注意的事,超时的长连接仍然是正常关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1595 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1596
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1597 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1598
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1599
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1600 <directive name="resolver">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1601 <syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1602 <value>address</value> ...
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1603 [<literal>valid</literal>=<value>time</value>]</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1604 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1605 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1606 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1607 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1608
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1609 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1610 配置将后端服务器的名字解析成ip地址的名字服务器,比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1611 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1612 resolver 127.0.0.1 [::1]:5353;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1613 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1614 这里地址可以指定域名或者ip地址,可以带端口号(1.3.1,1.2.2)。如果未指定端口,nginx使用53端口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1615 以轮询方式发送请求到多台名字服务器。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1616 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1617 在1.1.7版以前,只允许配置一个名字服务器。而支持使用IPv6地址定义名字服务器则是从1.3.1和1.2.2版本开始。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1618 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1619 nginx会缓存名字解析的结果。默认情况下,缓存时间是名字解析响应中的TTL字段的值。也允许通过<literal>valid</literal>参数覆盖它:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1620 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1621 resolver 127.0.0.1 [::1]:5353 valid=30s;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1622 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1623 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1624 在1.1.9版以前,不可能调节缓存时间,nginx总会将响应缓存5分钟。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1625 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1626 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1627
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1628 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1629
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1630
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1631 <directive name="resolver_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1632 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1633 <default>30s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1634 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1635 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1636 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1637
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1638 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1639 为名字解析设置超时,比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1640 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1641 resolver_timeout 5s;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1642 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1643 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1644
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1645 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1646
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1647
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1648 <directive name="root">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1649 <syntax><value>path</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1650 <default>html</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1651 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1652 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1653 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1654 <context>if in location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1655
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1656 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1657 为请求设置根目录。比如,如果配置如下
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1658 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1659 location /i/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1660 root /data/w3;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1661 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1662 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1663 那么nginx将使用文件<path>/data/w3/i/top.gif</path>响应请求“<literal>/i/top.gif</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1664 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1665
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1666 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1667 <value>path</value>的值中可以包含除<var>$document_root</var>和<var>$realpath_root</var>以外的变量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1668 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1669
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1670 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1671 文件路径的构造仅仅是将URI拼在<literal>root</literal>指令的值后面。如果需要修改URI,应该使用<link id="alias"/>指令。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1672 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1673
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1674 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1675
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1676
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1677 <directive name="satisfy">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1678 <syntax><literal>all</literal> | <literal>any</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1679 <default>all</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1680 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1681 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1682 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1683
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1684 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1685 nginx进行访问限制的有<link doc="ngx_http_access_module.xml">ngx_http_access_module</link>模块和
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1686 <link doc="ngx_http_auth_basic_module.xml">ngx_http_auth_basic_module</link>模块。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1687 本指令设置成<literal>all</literal>时,表示只有当两个模块的所有限制条件(写入配置的)都授权访问时,允许请求访问;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1688 设置成<literal>any</literal>时,表示如果当任意模块的任意限制条件授权访问时,允许请求访问。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1689 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1690
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1691 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1692 举例:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1693 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1694 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1695 satisfy any;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1696
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1697 allow 192.168.1.0/32;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1698 deny all;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1699
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1700 auth_basic "closed site";
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1701 auth_basic_user_file conf/htpasswd;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1702 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1703 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1704 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1705
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1706 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1707
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1708
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1709 <directive name="satisfy_any">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1710 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1711 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1712 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1713 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1714 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1715
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1716 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1717 这条指令已被<link id="satisfy"/>指令的<literal>any</literal>参数取代。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1718 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1719
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1720 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1721
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1722
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1723 <directive name="send_lowat">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1724 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1725 <default>0</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1726 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1727 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1728 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1729
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1730 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1731 如果设置成非0值,nginx将尝试最小化向客户端发送数据的次数。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1732 这是通过将<link doc="../events.xml" id="kqueue"/>方法的<c-def>NOTE_LOWAT</c-def>标志,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1733 或者将套接字的<c-def>SO_SNDLOWAT</c-def>属性设置成指定的<value>size</value>实现的。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1734 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1735
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1736 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1737 这条指令在Linux、Solaris和Windows操作系统无效。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1738 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1739
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1740 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1741
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1742
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1743 <directive name="send_timeout">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1744 <syntax><value>time</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1745 <default>60s</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1746 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1747 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1748 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1749
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1750 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1751 设置向客户端传输响应的超时。超时仅指两次相邻写操作之间的时间间隔,而非整个响应的传输时间。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1752 如果客户端在这段时间中没有收到任何数据,连接将关闭。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1753 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1754
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1755 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1756
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1757
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1758 <directive name="sendfile">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1759
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1760 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1761 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1762 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1763 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1764 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1765 <context>if in location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1766
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1767 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1768 开启或关闭使用<c-func>sendfile</c-func>调用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1769 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1770
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1771 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1772
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1773
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1774 <directive name="sendfile_max_chunk">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1775
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1776 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1777 <default>0</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1778 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1779 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1780 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1781
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1782 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1783 设置为非0值时,可以限制在一次<c-func>sendfile</c-func>调用时传输的数据量。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1784 如果不进行限制,一个快速的连接可能会霸占整个worker进程的所有资源。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1785 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1786
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1787 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1788
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1789
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1790 <directive name="server">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1791 <syntax block="yes"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1792 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1793 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1794
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1795 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1796 表示开始设置虚拟主机的配置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1797 nginx没有明显分隔IP-based(基于IP地址)和name-based(基于<header>Host</header>请求头)这两种类型的虚拟主机,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1798 而是用<link id="listen"/>指令描述虚拟主机接受连接的地址和端口,用<link id="server_name"/>指令列出虚拟主机的所有主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1799 在文档“<link doc="request_processing.xml">Nginx如何处理一个请求</link>”中提供了示例配置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1800 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1801
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1802 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1803
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1804
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1805 <directive name="server_name">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1806 <syntax><value>name</value> ...</syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1807 <default>""</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1808 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1809
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1810 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1811 设置虚拟主机名,比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1812 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1813 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1814 server_name example.com www.example.com;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1815 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1816 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1817 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1818
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1819 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1820 第一个名字成为虚拟主机的首要主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1821 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1822
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1823 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1824 主机名中可以含有星号(“<literal>*</literal>”),以替代名字的开始部分或结尾部分:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1825 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1826 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1827 server_name example.com *.example.com www.example.*;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1828 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1829 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1830 上面这些名字称为通配符主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1831 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1832
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1833 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1834 上面例子中的前两个名字可以组合成一个:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1835 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1836 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1837 server_name .example.com;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1838 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1839 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1840 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1841
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1842 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1843 也可以在主机名中使用正则表达式,就是在名字前面补一个波浪线(“<literal>~</literal>”):
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1844 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1845 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1846 server_name www.example.com ~^www\d+\.example\.com$;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1847 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1848 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1849 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1850
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1851 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1852 可以在正则表达式中包含匹配组(0.7.40),后续被其他指令使用:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1853 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1854 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1855 server_name ~^(www\.)?(.+)$;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1856
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1857 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1858 root /sites/$2;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1859 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1860 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1861
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1862 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1863 server_name _;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1864
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1865 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1866 root /sites/default;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1867 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1868 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1869 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1870 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1871
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1872 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1873
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1874 正则表达式中的命名匹配组可以创建变量(0.8.25),后续被其他指令使用:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1875 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1876 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1877 server_name ~^(www\.)?(?&lt;domain&gt;.+)$;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1878
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1879 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1880 root /sites/$domain;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1881 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1882 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1883
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1884 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1885 server_name _;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1886
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1887 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1888 root /sites/default;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1889 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1890 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1891 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1892 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1893
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1894 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1895 如果参数值等于“<var>$hostname</var>”(0.9.4),将使用机器的hostname来替换。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1896 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1897
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1898 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1899 nginx也允许定义空主机名(0.7.11):
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1900 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1901 server {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1902 server_name www.example.com "";
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1903 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1904 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1905 这种主机名可以让虚拟主机处理没有<header>Host</header>请求头的请求,而不是让指定“地址:端口”的默认虚拟主机来处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1906 这是本指令的默认设置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1907 <note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1908 在0.8.48版以前,机器的hostname被用作默认设置。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1909 </note>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1910 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1911
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1912 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1913 通过名字查找虚拟主机时,如果一个名字可以匹配多个指定的配置,比如同时匹配上通配符和正则表达式,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1914 按下面优先级,使用先匹配上的虚拟主机:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1915 <list type="enum">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1916
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1917 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1918 确切的名字;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1919 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1920
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1921 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1922 最长的以星号起始的通配符名字,比如“<literal>*.example.com</literal>”;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1923 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1924
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1925 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1926 最长的以星号结束的通配符名字,比如“<literal>mail.*</literal>”;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1927 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1928
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1929 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1930 第一个匹配的正则表达式名字(按在配置文件中出现的顺序)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1931 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1932
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1933 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1934 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1935
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1936 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1937 另一篇文档“<link doc="server_names.xml">虚拟主机名</link>”对虚拟主机名的有详细的描述。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1938 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1939
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1940 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1941
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1942
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1943 <directive name="server_name_in_redirect">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1944 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1945 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1946 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1947 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1948 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1949
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1950 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1951 开启或关闭nginx将<link id="server_name"/>指令指定的首要虚拟主机名用于发起的重定向的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1952 关闭此功能时,nginx将使用<header>Host</header>请求头的中的名字,如果没有此请求头,nginx将使用虚拟主机所在的IP地址。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1953 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1954
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1955 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1956 重定向中端口的使用由<link id="port_in_redirect"/>指令控制。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1957 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1958
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1959 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1960
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1961
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1962 <directive name="server_names_hash_bucket_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1963 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1964 <default>32|64|128</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1965 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1966
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1967 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1968 设置主机名哈希表的表项长度,其默认值取决于处理器的缓存线长度。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1969 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1970 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1971
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1972 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1973
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1974
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1975 <directive name="server_names_hash_max_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1976 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1977 <default>512</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1978 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1979
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1980 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1981 设置主机名哈希表的最大<value>size</value>(桶容量)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1982 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1983 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1984
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1985 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1986
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1987
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1988 <directive name="server_tokens">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1989 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1990 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1991 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1992 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1993 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1994
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1995 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1996 开启或关闭在错误信息的<header>Server</header>响应头中输出nginx版本号。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1997 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1998
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1999 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2000
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2001
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2002 <directive name="tcp_nodelay">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2003 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2004 <default>on</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2005 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2006 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2007 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2008
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2009 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2010 开启或关闭nginx使用<c-def>TCP_NODELAY</c-def>选项的功能。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2011 这个选项仅在将连接转变为长连接的时候才被启用。(译者注,在upstream发送响应到客户端时也会启用)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2012 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2013
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2014 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2015
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2016
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2017 <directive name="tcp_nopush">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2018 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2019 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2020 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2021 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2022 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2023
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2024 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2025 开启或者关闭nginx在FreeBSD上使用<c-def>TCP_NOPUSH</c-def>套接字选项,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2026 在Linux上使用<c-def>TCP_CORK</c-def>套接字选项。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2027 选项仅在使用<link id="sendfile"/>的时候才开启。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2028 开启此选项允许
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2029 <list type="bullet">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2030
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2031 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2032 在Linux和FreeBSD&nbsp;4.*上将响应头和正文的开始部分一起发送;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2033 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2034
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2035 <listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2036 一次性发送整个文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2037 </listitem>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2038
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2039 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2040 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2041
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2042 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2043
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2044
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2045 <directive name="try_files">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2046 <syntax><value>file</value> ... <value>uri</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2047 <syntax><value>file</value> ... =<value>code</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2048 <default/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2049 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2050 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2051
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2052 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2053 按指定顺序检查文件是否存在,并且使用第一个找到的文件来处理请求,那么处理过程就是在当前上下文环境中进行的。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2054 文件路径是根据<link id="root"/>指令和<link id="alias"/>指令,将<value>file</value>参数拼接而成。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2055 可以在名字尾部添加斜线以检查目录是否存在,比如“<literal>$uri/</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2056 如果找不到任何文件,将按最后一个参数指定的<value>uri</value>进行内部跳转。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2057 比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2058 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2059 location /images/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2060 try_files $uri /images/default.gif;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2061 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2062
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2063 location = /images/default.gif {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2064 expires 30s;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2065 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2066 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2067 最后一个参数也可以指向一个命名路径,如下面的例子所示。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2068 从0.7.51版开始,最后一个参数也可以是<value>code</value>:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2069 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2070 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2071 try_files $uri $uri/index.html $uri.html =404;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2072 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2073 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2074 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2075
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2076 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2077 下面是代理Mongrel的例子:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2078 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2079 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2080 try_files /system/maintenance.html
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2081 $uri $uri/index.html $uri.html
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2082 @mongrel;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2083 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2084
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2085 location @mongrel {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2086 proxy_pass http://mongrel;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2087 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2088 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2089 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2090
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2091 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2092 下面是Drupal用FastCGI的例子:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2093 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2094 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2095 try_files $uri $uri/ @drupal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2096 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2097
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2098 location ~ \.php$ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2099 try_files $uri @drupal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2100
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2101 fastcgi_pass ...;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2102
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2103 fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2104 fastcgi_param SCRIPT_NAME $fastcgi_script_name;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2105 fastcgi_param QUERY_STRING $args;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2106
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2107 ... other fastcgi_param's
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2108 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2109
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2110 location @drupal {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2111 fastcgi_pass ...;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2112
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2113 fastcgi_param SCRIPT_FILENAME /path/to/index.php;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2114 fastcgi_param SCRIPT_NAME /index.php;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2115 fastcgi_param QUERY_STRING q=$uri&amp;$args;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2116
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2117 ... other fastcgi_param's
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2118 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2119 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2120 而下面的例子中
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2121 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2122 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2123 try_files $uri $uri/ @drupal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2124 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2125 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2126 <literal>try_files</literal>指令等价于
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2127 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2128 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2129 error_page 404 = @drupal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2130 log_not_found off;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2131 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2132 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2133 然后是这里,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2134 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2135 location ~ \.php$ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2136 try_files $uri @drupal;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2137
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2138 fastcgi_pass ...;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2139
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2140 fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2141
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2142 ...
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2143 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2144 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2145 <literal>try_files</literal>在将请求发送到FastCGI服务器以前检查PHP文件是否存在。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2146 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2147
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2148 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2149 下面是Wordpress和Joomla的例子:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2150 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2151 location / {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2152 try_files $uri $uri/ @wordpress;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2153 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2154
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2155 location ~ \.php$ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2156 try_files $uri @wordpress;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2157
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2158 fastcgi_pass ...;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2159
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2160 fastcgi_param SCRIPT_FILENAME /path/to$fastcgi_script_name;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2161 ... other fastcgi_param's
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2162 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2163
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2164 location @wordpress {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2165 fastcgi_pass ...;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2166
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2167 fastcgi_param SCRIPT_FILENAME /path/to/index.php;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2168 ... other fastcgi_param's
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2169 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2170 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2171 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2172
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2173 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2174
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2175
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2176 <directive name="types">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2177 <syntax block="yes"/>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2178 <default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2179 text/html html;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2180 image/gif gif;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2181 image/jpeg jpg;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2182 </default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2183 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2184 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2185 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2186
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2187 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2188 设置文件扩展名和响应的MIME类型的映射表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2189 可以将多个扩展名映射到同一种类型,比如:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2190 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2191 types {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2192 application/octet-stream bin exe dll;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2193 application/octet-stream deb;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2194 application/octet-stream dmg;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2195 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2196 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2197 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2198
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2199 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2200 随nginx发行的<path>conf/mime.types</path>文件中包含了足够全面的映射表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2201 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2202
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2203 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2204 为了是为某个路径的所有请求生成MIME类型“<literal>application/octet-stream</literal>”,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2205 可以使用下面配置:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2206 <example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2207 location /download/ {
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2208 types { }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2209 default_type application/octet-stream;
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2210 }
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2211 </example>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2212 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2213
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2214 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2215
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2216
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2217 <directive name="types_hash_bucket_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2218 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2219 <default>32|64|128</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2220 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2221 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2222 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2223
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2224 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2225 设置MIME类型哈希表的表项长度,其默认值取决于处理器的缓存线长度。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2226 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2227 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2228
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2229 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2230
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2231
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2232 <directive name="types_hash_max_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2233 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2234 <default>1024</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2235 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2236 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2237 <context>location</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2238
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2239 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2240 设置MIME类型哈希表的最大<value>size</value>(桶容量)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2241 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2242 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2243
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2244 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2245
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2246
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2247 <directive name="underscores_in_headers">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2248 <syntax><literal>on</literal> | <literal>off</literal></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2249 <default>off</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2250 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2251 <context>server</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2252
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2253 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2254 允许或禁止在客户端请求头中使用下划线。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2255 如果禁止,含有下划线的请求头将被标志为非法请求头并接受<link id="ignore_invalid_headers"/>指令的处理。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2256 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2257
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2258 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2259 可以在默认主机的<link id="server"/>配置级别定义此命令。这样,指令设置将覆盖监听同一地址和端口的所有虚拟主机。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2260 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2261
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2262 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2263
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2264
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2265 <directive name="variables_hash_bucket_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2266 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2267 <default>64</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2268 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2269
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2270 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2271 设置变量哈希表的表项长度,其默认值取决于处理器的缓存线长度。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2272 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2273 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2274
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2275 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2276
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2277
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2278 <directive name="variables_hash_max_size">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2279 <syntax><value>size</value></syntax>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2280 <default>512</default>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2281 <context>http</context>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2282
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2283 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2284 设置变量哈希表的最大<value>size</value>(桶容量)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2285 另一篇文档“<link doc="../hash.xml">设置哈希表</link>”详细介绍了如何设置哈希表。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2286 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2287
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2288 </directive>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2289
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2290 </section>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2291
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2292
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2293 <section id="variables" name="内嵌变量">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2294
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2295 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2296 <literal>ngx_http_core_module</literal>模块支持内嵌变量,变量名与Apache服务器对应。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2297 首先,这些变量可以表示客户端的请求头字段,诸如<var>$http_user_agent</var>、<var>$http_cookie</var>等等。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2298 nginx也支持其他变量:
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2299 <list type="tag">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2300
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2301 <tag-name id="var_arg_"><var>$arg_</var><value>name</value></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2302 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2303 请求行中的<value>name</value>参数。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2304 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2305
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2306 <tag-name id="var_args"><var>$args</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2307 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2308 请求行中参数字符串。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2309 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2310
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2311 <tag-name id="var_binary_remote_addr"><var>$binary_remote_addr</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2312 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2313 客户端IP地址的二进制形式,值的长度总是4字节。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2314 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2315
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2316 <tag-name id="var_body_bytes_sent"><var>$body_bytes_sent</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2317 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2318 nginx返回给客户端的字节数,不含响应头。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2319 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2320
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2321 <tag-name id="var_bytes_sent"><var>$bytes_sent</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2322 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2323 nginx返回给客户端的字节数(1.3.8, 1.2.5)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2324 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2325
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2326 <tag-name id="var_connection"><var>$connection</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2327 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2328 连接的序列号(1.3.8, 1.2.5)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2329 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2330
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2331 <tag-name id="var_content_length"><var>$content_length</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2332 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2333 <header>Content-Length</header>请求头的值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2334 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2335
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2336 <tag-name id="var_content_type"><var>$content_type</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2337 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2338 <header>Content-Type</header>请求头的值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2339 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2340
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2341 <tag-name id="var_cookie_"><var>$cookie_</var><value>name</value></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2342 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2343 名为<value>name</value>的cookie。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2344 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2345
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2346 <tag-name id="var_document_root"><var>$document_root</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2347 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2348 当前请求的<link id="root"/>指令或<link id="alias"/>指令的配置值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2349 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2350
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2351 <tag-name id="var_document_uri"><var>$document_uri</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2352 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2353 与<var>$uri</var>相同。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2354 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2355
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2356 <tag-name id="var_host"><var>$host</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2357 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2358 <header>Host</header>请求头的值,如果没有该请求头,则为与请求对应的虚拟主机的首要主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2359 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2360
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2361 <tag-name id="var_hostname"><var>$hostname</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2362 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2363 机器名称。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2364 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2365
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2366 <tag-name id="var_http_"><var>$http_</var><value>name</value></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2367 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2368 任意请求头的值;变量名的后半部为转化为小写并且用下划线替代横线后的请求头名称。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2369 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2370
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2371 <tag-name id="var_https"><var>$https</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2372 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2373 如果连接是SSL模块,返回“<literal>on</literal>”,否则返回空字符串。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2374 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2375
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2376 <tag-name id="var_is_args"><var>$is_args</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2377 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2378 如果请求行带有参数,返回“<literal>?</literal>”,否则返回空字符串。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2379 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2380
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2381 <tag-name id="var_limit_rate"><var>$limit_rate</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2382 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2383 允许设置此值来限制连接的传输速率。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2384 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2385
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2386 <tag-name id="var_msec"><var>$msec</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2387 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2388 当前时间,单位是秒,精度是毫秒。(1.3.9, 1.2.6)
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2389 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2390
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2391 <tag-name id="var_nginx_version"><var>$nginx_version</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2392 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2393 nginx版本号。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2394 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2395
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2396 <tag-name id="var_pid"><var>$pid</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2397 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2398 worker进程的PID。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2399 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2400
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2401 <tag-name id="var_query_string"><var>$query_string</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2402 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2403 与<var>$args</var>相同。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2404 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2405
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2406 <tag-name id="var_realpath_root"><var>$realpath_root</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2407 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2408 按<link id="root"/>指令或<link id="alias"/>指令算出的当前请求的绝对路径。其中的符号链接都会解析成真是文件路径。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2409 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2410
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2411 <tag-name id="var_remote_addr"><var>$remote_addr</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2412 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2413 客户端IP地址。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2414 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2415
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2416 <tag-name id="var_remote_port"><var>$remote_port</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2417 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2418 客户端端口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2419 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2420
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2421 <tag-name id="var_remote_user"><var>$remote_user</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2422 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2423 为基本用户认证提供的用户名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2424 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2425
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2426 <tag-name id="var_request"><var>$request</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2427 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2428 完整的原始请求行。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2429 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2430
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2431 <tag-name id="var_request_body"><var>$request_body</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2432 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2433 请求正文。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2434 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2435 在由<link doc="ngx_http_proxy_module.xml" id="proxy_pass"/>指令和
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2436 <link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass"/>指令处理的路径中,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2437 这个变量值可用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2438 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2439 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2440
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2441 <tag-name id="var_reuqest_body_file"><var>$request_body_file</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2442 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2443 请求正文的临时文件名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2444 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2445 处理完成时,临时文件将被删除。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2446 如果希望总是将请求正文写入文件,需要开启<link id="client_body_in_file_only"/>。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2447 如果在被代理的请求或FastCGI请求中传递临时文件名,就应该禁止传递请求正文本身。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2448 使用<link doc="ngx_http_proxy_module.xml" id="proxy_pass_request_body">proxy_pass_request_body off</link>指令
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2449 和<link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass_request_body">fastcgi_pass_request_body off</link>指令
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2450 分别禁止在代理和FastCGI中传递请求正文。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2451 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2452 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2453
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2454 <tag-name id="var_request_complete"><var>$request_completion</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2455 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2456 请求完成时返回“<literal>OK</literal>”,否则返回空字符串。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2457 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2458
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2459 <tag-name id="var_request_filename"><var>$request_filename</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2460 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2461 基于<link id="root"/>指令或<link id="alias"/>指令,以及请求URI,得到的当前请求的文件路径。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2462 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2463
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2464 <tag-name id="var_request_method"><var>$request_method</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2465 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2466 HTTP方法,通常为“<literal>GET</literal>”或者“<literal>POST</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2467 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2468
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2469 <tag-name id="var_request_time"><var>$request_time</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2470 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2471 请求处理的时间,单位为秒,精度是毫秒(1.3.9, 1.2.6);请求处理时间从由客户端接收到第一个字节开始计算。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2472 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2473
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2474 <tag-name id="var_request_uri"><var>$request_uri</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2475 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2476 完整的原始请求行(带参数)。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2477 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2478
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2479 <tag-name id="var_scheme"><var>$scheme</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2480 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2481 请求协议类型,为“<literal>http</literal>”或“<literal>https</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2482 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2483
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2484 <tag-name id="var_sent_http_"><var>$sent_http_</var><value>name</value></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2485 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2486 任意的响应头字段的值。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2487 变量名的后半部为转化为小写并且用下划线替代横线后的响应头名称。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2488 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2489
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2490 <tag-name id="var_server_addr"><var>$server_addr</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2491 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2492 接受请求的服务器地址。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2493 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2494 为计算这个值,通常需要进行一次系统调用。为了避免系统调用,必须指定<link id="listen"/>指令
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2495 的地址,并且使用<literal>bind</literal>参数。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2496 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2497 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2498
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2499 <tag-name id="var_server_name"><var>$server_name</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2500 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2501 接受请求的虚拟主机的首要主机名。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2502 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2503
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2504 <tag-name id="var_server_port"><var>$server_port</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2505 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2506 接受请求的虚拟主机的端口。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2507 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2508
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2509 <tag-name id="var_server_protocol"><var>$server_protocol</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2510 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2511 请求协议,通常为“<literal>HTTP/1.0</literal>”或“<literal>HTTP/1.1</literal>”。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2512 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2513
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2514 <tag-name id="var_status"><var>$status</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2515 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2516 响应状态码。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2517 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2518
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2519 <tag-name id="var_tcpinfo_">
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2520 <var>$tcpinfo_rtt</var>,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2521 <var>$tcpinfo_rttvar</var>,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2522 <var>$tcpinfo_snd_cwnd</var>,
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2523 <var>$tcpinfo_rcv_space</var>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2524 </tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2525 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2526 客户端TCP连接的信息,在支持套接字选项<c-def>TCP_INFO</c-def>的系统中可用。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2527 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2528
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2529 <tag-name id="var_uri"><var>$uri</var></tag-name>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2530 <tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2531 当前请求<link id="location">规范化</link>以后的URI。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2532 <para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2533 变量<var>$uri</var>的值可能随请求的处理过程而改变。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2534 比如,当进行内部跳转时,或者使用默认页文件。
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2535 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2536 </tag-desc>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2537
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2538 </list>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2539 </para>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2540
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2541 </section>
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2542
ceb8a4e374b7 Updated the Chinese documentation.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2543 </module>