Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_limit_conn_module.xml @ 3099:9cfda14d0109 default tip
freenginx-1.27.4
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 03 Sep 2024 13:15:18 +0300 |
parents | 9eadb98ec770 |
children |
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" |
3043
9eadb98ec770
Free nginx: removed commercial version documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2956
diff
changeset
|
13 rev="15"> |
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. |
2087
4931a7ba6a32
Restored proper tense in limit_conn description.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2013
diff
changeset
|
25 A connection is counted only if it has a request being processed by the server |
966 | 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 |
2013
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
67 <link id="limit_conn_status">error</link> |
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
68 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> |
2956
a85e4d126bc7
Updated docs for the upcoming NGINX Plus release.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2593
diff
changeset
|
80 In HTTP/2 and HTTP/3, |
a85e4d126bc7
Updated docs for the upcoming NGINX Plus release.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2593
diff
changeset
|
81 each concurrent request is considered a separate connection. |
1347
7d028fc94593
Added a note about SPDY connections in limit_conn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1320
diff
changeset
|
82 </note> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 <para> |
1628
d846df055f03
Disambiguated a sentence about multiple limit_conn limits.
Ruslan Ermilov <ru@nginx.com>
parents:
1623
diff
changeset
|
86 There could be several <literal>limit_conn</literal> directives. |
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, |
1623
a3509ca11ab4
The term "virtual server" is more common in nginx.
Ruslan Ermilov <ru@nginx.com>
parents:
1566
diff
changeset
|
89 the total number of connections to the virtual server: |
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> |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2495
diff
changeset
|
104 These directives are inherited from the previous configuration level |
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2495
diff
changeset
|
105 if and only if there are no <literal>limit_conn</literal> directives |
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2495
diff
changeset
|
106 defined on the current level. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
107 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
108 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
109 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 |
2464
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
112 <directive name="limit_conn_dry_run"> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
113 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
114 <default>off</default> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
115 <context>http</context> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
116 <context>server</context> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
117 <context>location</context> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
118 <appeared-in>1.17.6</appeared-in> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
119 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
120 <para> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
121 Enables the dry run mode. |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
122 In this mode, the number of connections is not limited, however, |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
123 in the shared memory zone, the number of excessive connections is accounted |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
124 as usual. |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
125 </para> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
126 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
127 </directive> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
128 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2087
diff
changeset
|
129 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
130 <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
|
131 <syntax> |
271 | 132 <literal>info</literal> | |
133 <literal>notice</literal> | | |
134 <literal>warn</literal> | | |
135 <literal>error</literal></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
136 <default>error</default> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
138 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
139 <context>location</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
140 <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
|
141 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
142 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
143 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
|
144 limits the number of connections. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
145 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
146 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
147 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
148 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 |
870
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
150 <directive name="limit_conn_status"> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
151 <syntax><value>code</value></syntax> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
152 <default>503</default> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
153 <context>http</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
154 <context>server</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
155 <context>location</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
156 <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
|
157 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
158 <para> |
966 | 159 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
|
160 </para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
161 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
162 </directive> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
163 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
625
diff
changeset
|
164 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 <directive name="limit_conn_zone"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
166 <syntax> |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
167 <value>key</value> |
271 | 168 <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
|
169 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
170 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
171 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
172 <para> |
966 | 173 Sets parameters for a shared memory zone |
174 that will keep states for various keys. | |
175 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
|
176 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
|
177 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
|
178 <note> |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
179 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
|
180 </note> |
966 | 181 Usage example: |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
182 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
183 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
|
184 </example> |
966 | 185 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
|
186 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
|
187 <var>$binary_remote_addr</var> variable is used here. |
966 | 188 The <var>$remote_addr</var> variable’s size can |
189 vary from 7 to 15 bytes. | |
190 The stored state occupies either | |
191 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
|
192 bytes on 64-bit platforms. |
966 | 193 The <var>$binary_remote_addr</var> variable’s size |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1628
diff
changeset
|
194 is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses. |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1628
diff
changeset
|
195 The stored state always occupies 32 or 64 bytes |
966 | 196 on 32-bit platforms and 64 bytes on 64-bit platforms. |
197 One megabyte zone can keep about 32 thousand 32-byte states | |
198 or about 16 thousand 64-byte states. | |
199 If the zone storage is exhausted, the server will return the | |
2013
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
200 <link id="limit_conn_status">error</link> |
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
201 to all further requests. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
202 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
203 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
204 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
205 |
364 | 206 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
207 <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
|
208 <syntax> |
271 | 209 <value>name</value> |
210 <value>$variable</value> | |
211 <value>size</value></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
212 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
213 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
214 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
215 <para> |
1312
91a4eee45eb7
Limit_conn: the limit_zone directive removed from the code.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
966
diff
changeset
|
216 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
|
217 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
|
218 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
|
219 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
|
220 <note> |
271 | 221 <literal>limit_conn_zone</literal> |
222 <value>$variable</value> | |
223 <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
|
224 </note> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
225 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
226 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
227 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
228 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
229 </section> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
230 |
2465
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
231 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
232 <section id="variables" name="Embedded Variables"> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
233 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
234 <para> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
235 <list type="tag"> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
236 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
237 <tag-name id="var_limit_conn_status"><var>$limit_conn_status</var></tag-name> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
238 <tag-desc> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
239 keeps the result of limiting the number of connections (1.17.6): |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
240 <literal>PASSED</literal>, |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
241 <literal>REJECTED</literal>, or |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
242 <literal>REJECTED_DRY_RUN</literal> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
243 </tag-desc> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
244 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
245 </list> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
246 </para> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
247 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
248 </section> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
249 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
250 </module> |