Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_limit_conn_module.xml @ 1384:66ee77849563
Documented the use_temp_path parameter of the proxy_cache_path directive.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 24 Dec 2014 19:31:21 +0300 |
parents | 7d028fc94593 |
children | 0ca33afb461b |
rev | line source |
---|---|
222
bfe3eff81d04
Removed redundant encoding specification.
Ruslan Ermilov <ru@nginx.com>
parents:
207
diff
changeset
|
1 <?xml version="1.0"?> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
575
diff
changeset
|
3 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
575
diff
changeset
|
4 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
575
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
575
diff
changeset
|
6 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
575
diff
changeset
|
7 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <module name="Module ngx_http_limit_conn_module" |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 link="/en/docs/http/ngx_http_limit_conn_module.html" |
589 | 12 lang="en" |
1347
7d028fc94593
Added a note about SPDY connections in limit_conn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1320
diff
changeset
|
13 rev="5"> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 <section id="summary"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 <para> |
966 | 18 The <literal>ngx_http_limit_conn_module</literal> module is used to |
19 limit the number of connections per the defined key, in | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 particular, the number of connections from a single IP address. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 <para> |
966 | 24 Not all connections are counted. |
25 A connection is counted only if it has a request processed by the server | |
26 and the whole request header has already been read. | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 </section> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 <section id="example" name="Example Configuration"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 http { |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 limit_conn_zone $binary_remote_addr zone=addr:10m; |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 ... |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 server { |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 ... |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 location /download/ { |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 limit_conn addr 1; |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 } |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 </example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 </section> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 <section id="directives" name="Directives"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 <directive name="limit_conn"> |
271 | 57 <syntax><value>zone</value> <value>number</value></syntax> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 <context>location</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 <para> |
966 | 64 Sets the shared memory zone |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
65 and the maximum allowed number of connections for a given key value. |
966 | 66 When this limit is exceeded, the server will return the |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 <http-status code="503" text="Service Temporarily Unavailable"/> |
966 | 68 error in reply to a request. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 For example, the directives |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 <example> |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
71 limit_conn_zone $binary_remote_addr zone=addr:10m; |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
73 server { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
74 location /download/ { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
75 limit_conn addr 1; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
76 } |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 </example> |
966 | 78 allow only one connection per an IP address at a time. |
1347
7d028fc94593
Added a note about SPDY connections in limit_conn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1320
diff
changeset
|
79 <note> |
7d028fc94593
Added a note about SPDY connections in limit_conn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1320
diff
changeset
|
80 In SPDY, each concurrent request is considered a separate connection. |
7d028fc94593
Added a note about SPDY connections in limit_conn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1320
diff
changeset
|
81 </note> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 <para> |
271 | 85 When several <literal>limit_conn</literal> directives are specified, |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 any configured limit will apply. |
207
2df68271c898
Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents:
180
diff
changeset
|
87 For example, the following configuration will limit the number |
966 | 88 of connections to the server per a client IP and, at the same time, |
89 the total number of connections to the virtual host: | |
207
2df68271c898
Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents:
180
diff
changeset
|
90 <example> |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
91 limit_conn_zone $binary_remote_addr zone=perip:10m; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
92 limit_conn_zone $server_name zone=perserver:10m; |
207
2df68271c898
Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents:
180
diff
changeset
|
93 |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
94 server { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
95 ... |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
96 limit_conn perip 10; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
97 limit_conn perserver 100; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
98 } |
207
2df68271c898
Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents:
180
diff
changeset
|
99 </example> |
2df68271c898
Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents:
180
diff
changeset
|
100 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
101 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
102 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 These directives are inherited from the previous level if and |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
105 only if there are no |
271 | 106 <literal>limit_conn</literal> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
107 directives on the current level. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
108 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
109 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
112 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
113 <directive name="limit_conn_log_level"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
114 <syntax> |
271 | 115 <literal>info</literal> | |
116 <literal>notice</literal> | | |
117 <literal>warn</literal> | | |
118 <literal>error</literal></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
119 <default>error</default> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
120 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
121 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
122 <context>location</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
123 <appeared-in>0.8.18</appeared-in> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
124 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
125 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
126 Sets the desired logging level for cases when the server |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
127 limits the number of connections. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
128 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
129 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
130 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
131 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
132 |
870
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
133 <directive name="limit_conn_status"> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
134 <syntax><value>code</value></syntax> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
135 <default>503</default> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
136 <context>http</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
137 <context>server</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
138 <context>location</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
139 <appeared-in>1.3.15</appeared-in> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
140 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
141 <para> |
966 | 142 Sets the status code to return in response to rejected requests. |
870
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
143 </para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
144 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
145 </directive> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
146 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
147 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
148 <directive name="limit_conn_zone"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 <syntax> |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
150 <value>key</value> |
271 | 151 <literal>zone</literal>=<value>name</value>:<value>size</value></syntax> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
152 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
153 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
154 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
155 <para> |
966 | 156 Sets parameters for a shared memory zone |
157 that will keep states for various keys. | |
158 In particular, the state includes the current number of connections. | |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
159 The <value>key</value> can contain text, variables, and their combination. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
160 Requests with an empty key value are not accounted. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
161 <note> |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
162 Prior to version 1.7.6, a <value>key</value> could contain exactly one variable. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
163 </note> |
966 | 164 Usage example: |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
166 limit_conn_zone $binary_remote_addr zone=addr:10m; |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
167 </example> |
966 | 168 Here, a client IP address serves as a key. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
169 Note that instead of <var>$remote_addr</var>, the |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
170 <var>$binary_remote_addr</var> variable is used here. |
966 | 171 The <var>$remote_addr</var> variable’s size can |
172 vary from 7 to 15 bytes. | |
173 The stored state occupies either | |
174 32 or 64 bytes of memory on 32-bit platforms and always 64 | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
175 bytes on 64-bit platforms. |
966 | 176 The <var>$binary_remote_addr</var> variable’s size |
177 is always 4 bytes. | |
178 The stored state always occupies 32 bytes | |
179 on 32-bit platforms and 64 bytes on 64-bit platforms. | |
180 One megabyte zone can keep about 32 thousand 32-byte states | |
181 or about 16 thousand 64-byte states. | |
182 If the zone storage is exhausted, the server will return the | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
183 <http-status code="503" text="Service Temporarily Unavailable"/> |
966 | 184 error to all further requests. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
185 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
186 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
187 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
188 |
364 | 189 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
190 <directive name="limit_zone"> |
270
945d7299c26c
Spaces are now preserved here, so removed all the hacks.
Ruslan Ermilov <ru@nginx.com>
parents:
227
diff
changeset
|
191 <syntax> |
271 | 192 <value>name</value> |
193 <value>$variable</value> | |
194 <value>size</value></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
195 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
196 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
197 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
198 <para> |
1312
91a4eee45eb7
Limit_conn: the limit_zone directive removed from the code.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
966
diff
changeset
|
199 This directive was made obsolete in version 1.1.8 |
91a4eee45eb7
Limit_conn: the limit_zone directive removed from the code.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
966
diff
changeset
|
200 and was removed in version 1.7.6. |
91a4eee45eb7
Limit_conn: the limit_zone directive removed from the code.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
966
diff
changeset
|
201 An equivalent <link id="limit_conn_zone"/> directive |
180
9e7d0c9c7eaa
Mentioned the compatible "limit_conn_zone" directive syntax for the
Ruslan Ermilov <ru@nginx.com>
parents:
179
diff
changeset
|
202 with a changed syntax should be used instead: |
9e7d0c9c7eaa
Mentioned the compatible "limit_conn_zone" directive syntax for the
Ruslan Ermilov <ru@nginx.com>
parents:
179
diff
changeset
|
203 <note> |
271 | 204 <literal>limit_conn_zone</literal> |
205 <value>$variable</value> | |
206 <literal>zone</literal>=<value>name</value>:<value>size</value>; | |
180
9e7d0c9c7eaa
Mentioned the compatible "limit_conn_zone" directive syntax for the
Ruslan Ermilov <ru@nginx.com>
parents:
179
diff
changeset
|
207 </note> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
208 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
209 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
210 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
211 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
212 </section> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
213 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
214 </module> |