Mercurial > hg > nginx-site
annotate xml/en/docs/stream/ngx_stream_limit_conn_module.xml @ 2741:4fb1aaad4182
njs-0.6.0.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 16 Jun 2021 13:50:54 +0100 |
parents | eeed494bba51 |
children | 9eadb98ec770 |
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 |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
10 <module name="Module ngx_stream_limit_conn_module" |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
11 link="/en/docs/stream/ngx_stream_limit_conn_module.html" |
589 | 12 lang="en" |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2495
diff
changeset
|
13 rev="7"> |
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> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
18 The <literal>ngx_stream_limit_conn_module</literal> module (1.9.3) is used to |
966 | 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 </section> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 <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
|
27 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 <example> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
30 stream { |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 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
|
32 |
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 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 server { |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 ... |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
39 limit_conn addr 1; |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
40 limit_conn_log_level error; |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
41 } |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
42 } |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 </example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 </section> |
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 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 <section id="directives" name="Directives"> |
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 <directive name="limit_conn"> |
271 | 52 <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
|
53 <default/> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
54 <context>stream</context> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 <para> |
966 | 58 Sets the shared memory zone |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
59 and the maximum allowed number of connections for a given key value. |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
60 When this limit is exceeded, the server will close the connection. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 For example, the directives |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 <example> |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
63 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
|
64 |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
65 server { |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
66 ... |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
67 limit_conn addr 1; |
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
68 } |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 </example> |
966 | 70 allow only one connection per an IP address at a time. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 <para> |
271 | 74 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
|
75 any configured limit will apply. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 <para> |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2495
diff
changeset
|
79 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
|
80 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
|
81 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
|
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 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 |
2464
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
87 <directive name="limit_conn_dry_run"> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
88 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
89 <default>off</default> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
90 <context>stream</context> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
91 <context>server</context> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
92 <appeared-in>1.17.6</appeared-in> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
93 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
94 <para> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
95 Enables the dry run mode. |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
96 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:
1744
diff
changeset
|
97 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:
1744
diff
changeset
|
98 as usual. |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
99 </para> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
100 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
101 </directive> |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
102 |
5d7fd7d9a2b6
Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1744
diff
changeset
|
103 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 <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
|
105 <syntax> |
271 | 106 <literal>info</literal> | |
107 <literal>notice</literal> | | |
108 <literal>warn</literal> | | |
109 <literal>error</literal></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 <default>error</default> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
111 <context>stream</context> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
112 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
113 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
114 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
115 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
|
116 limits the number of connections. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
117 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
118 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
119 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
120 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
121 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
122 <directive name="limit_conn_zone"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
123 <syntax> |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
1312
diff
changeset
|
124 <value>key</value> |
271 | 125 <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
|
126 <default/> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
127 <context>stream</context> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
128 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
129 <para> |
966 | 130 Sets parameters for a shared memory zone |
131 that will keep states for various keys. | |
132 In particular, the state includes the current number of connections. | |
1744
ab56dcd73af2
Added variables to stream hash, limit_conn_zone, proxy_bind.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1699
diff
changeset
|
133 The <value>key</value> can contain text, variables, |
ab56dcd73af2
Added variables to stream hash, limit_conn_zone, proxy_bind.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1699
diff
changeset
|
134 and their combinations (1.11.2). |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
135 Connections with an empty key value are not accounted. |
966 | 136 Usage example: |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
138 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
|
139 </example> |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
140 Here, the key is a client IP address set by the |
1744
ab56dcd73af2
Added variables to stream hash, limit_conn_zone, proxy_bind.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1699
diff
changeset
|
141 <literal>$binary_remote_addr</literal> variable. |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
142 The size of <literal>$binary_remote_addr</literal> |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1517
diff
changeset
|
143 is 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:
1517
diff
changeset
|
144 The stored state always occupies 32 or 64 bytes |
966 | 145 on 32-bit platforms and 64 bytes on 64-bit platforms. |
146 One megabyte zone can keep about 32 thousand 32-byte states | |
147 or about 16 thousand 64-byte states. | |
1517
53ae63cb4cfa
Added the limit_conn module for stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1347
diff
changeset
|
148 If the zone storage is exhausted, the server will close the connection. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
150 |
2495
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
151 <para> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
152 <note> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
153 Additionally, as part of our |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
154 <commercial_version>commercial subscription</commercial_version>, |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
155 the |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
156 <link doc="../http/ngx_http_api_module.xml" id="stream_limit_conns_">status information</link> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
157 for each such shared memory zone can be |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
158 <link doc="../http/ngx_http_api_module.xml" id="getStreamLimitConnZone">obtained</link> or |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
159 <link doc="../http/ngx_http_api_module.xml" id="deleteStreamLimitConnZoneStat">reset</link> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
160 with the <link doc="../http/ngx_http_api_module.xml">API</link> since 1.17.7. |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
161 </note> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
162 </para> |
e4332b7580bb
Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2465
diff
changeset
|
163 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
164 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 |
2465
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
166 </section> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
167 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
168 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
169 <section id="variables" name="Embedded Variables"> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
170 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
171 <para> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
172 <list type="tag"> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
173 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
174 <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
|
175 <tag-desc> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
176 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
|
177 <literal>PASSED</literal>, |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
178 <literal>REJECTED</literal>, or |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
179 <literal>REJECTED_DRY_RUN</literal> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
180 </tag-desc> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
181 |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
182 </list> |
07c4f2c66c97
Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2464
diff
changeset
|
183 </para> |
364 | 184 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
185 </section> |
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 </module> |