annotate xml/en/docs/http/ngx_http_limit_conn_module.xml @ 2769:16f6fa718be2

Updated TLSv1.3 support notes. Previous notes described some early development snapshot of OpenSSL 1.1.1 with disabled TLSv1.3 by default. It was then enabled in the first alpha. Further, the updated text covers later major releases such as OpenSSL 3.0.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 30 Sep 2021 16:29:20 +0300
parents eeed494bba51
children a85e4d126bc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
12 lang="en"
2593
eeed494bba51 Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents: 2495
diff changeset
13 rev="14">
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
18 The <literal>ngx_http_limit_conn_module</literal> module is used to
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
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>
1566
0ca33afb461b Added the http2 module.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1347
diff changeset
80 In HTTP/2 and SPDY, 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
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>
1628
d846df055f03 Disambiguated a sentence about multiple limit_conn limits.
Ruslan Ermilov <ru@nginx.com>
parents: 1623
diff changeset
85 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
86 For example, the following configuration will limit the number
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
87 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
88 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
89 <example>
351
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
90 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
91 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
92
351
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
93 server {
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
94 ...
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
95 limit_conn perip 10;
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
96 limit_conn perserver 100;
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
97 }
207
2df68271c898 Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents: 180
diff changeset
98 </example>
2df68271c898 Provided an example of using several "limit_conn" directives.
Ruslan Ermilov <ru@nginx.com>
parents: 180
diff changeset
99
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
100 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
101
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
102 <para>
2593
eeed494bba51 Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents: 2495
diff changeset
103 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
104 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
105 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
106 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
107
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
108 </directive>
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
2464
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
111 <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
112 <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
113 <default>off</default>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
114 <context>http</context>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
115 <context>server</context>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
116 <context>location</context>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
117 <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
118
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
119 <para>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
120 Enables the dry run mode.
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
121 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
122 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
123 as usual.
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
124 </para>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
125
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
126 </directive>
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
127
5d7fd7d9a2b6 Documented limit_conn_dry_run for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2087
diff changeset
128
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
129 <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
130 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
131 <literal>info</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
132 <literal>notice</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
133 <literal>warn</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
134 <literal>error</literal></syntax>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
135 <default>error</default>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
136 <context>http</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
137 <context>server</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
138 <context>location</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
139 <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
140
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
141 <para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
142 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
143 limits the number of connections.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
144 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
145
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
146 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
147
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
148
870
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
149 <directive name="limit_conn_status">
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
150 <syntax><value>code</value></syntax>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
151 <default>503</default>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
152 <context>http</context>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
153 <context>server</context>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
154 <context>location</context>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
155 <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
156
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
157 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
158 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
159 </para>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
160
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
161 </directive>
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
diff changeset
162
6087d3fa6919 The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents: 625
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 name="limit_conn_zone">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
165 <syntax>
1320
f15a983cac66 Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1312
diff changeset
166 <value>key</value>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
167 <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
168 <default/>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
169 <context>http</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
170
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
171 <para>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
172 Sets parameters for a shared memory zone
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
173 that will keep states for various keys.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
174 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
175 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
176 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
177 <note>
f15a983cac66 Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents: 1312
diff changeset
178 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
179 </note>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
180 Usage example:
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
181 <example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
182 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
183 </example>
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
184 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
185 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
186 <var>$binary_remote_addr</var> variable is used here.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
187 The <var>$remote_addr</var> variable’s size can
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
188 vary from 7 to 15 bytes.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
189 The stored state occupies either
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
190 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
191 bytes on 64-bit platforms.
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
192 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
193 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
194 The stored state always occupies 32 or 64 bytes
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
195 on 32-bit platforms and 64 bytes on 64-bit platforms.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
196 One megabyte zone can keep about 32 thousand 32-byte states
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
197 or about 16 thousand 64-byte states.
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 870
diff changeset
198 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
199 <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
200 to all further requests.
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
201 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
202
2495
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
203 <para>
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
204 <note>
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
205 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
206 <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
207 the
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
208 <link doc="ngx_http_api_module.xml" id="http_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
209 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
210 <link doc="ngx_http_api_module.xml" id="getHttpLimitConnZone">obtained</link> or
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
211 <link doc="ngx_http_api_module.xml" id="deleteHttpLimitConnZoneStat">reset</link>
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
212 with the <link doc="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
213 </note>
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
214 </para>
e4332b7580bb Mentioned API in limit_conn_zone and limit_req_zone.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2465
diff changeset
215
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
216 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
217
364
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
218
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
219 <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
220 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
221 <value>name</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
222 <value>$variable</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
223 <value>size</value></syntax>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
224 <default/>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
225 <context>http</context>
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 <para>
1312
91a4eee45eb7 Limit_conn: the limit_zone directive removed from the code.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
228 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
229 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
230 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
231 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
232 <note>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
233 <literal>limit_conn_zone</literal>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
234 <value>$variable</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
235 <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
236 </note>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
237 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
238
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
239 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
240
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
241 </section>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
242
2465
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
243
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
244 <section id="variables" name="Embedded Variables">
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
245
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 <list type="tag">
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
248
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
249 <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
250 <tag-desc>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
251 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
252 <literal>PASSED</literal>,
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
253 <literal>REJECTED</literal>, or
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
254 <literal>REJECTED_DRY_RUN</literal>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
255 </tag-desc>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
256
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
257 </list>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
258 </para>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
259
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
260 </section>
07c4f2c66c97 Documented $limit_conn_status for http and stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 2464
diff changeset
261
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
262 </module>