annotate xml/en/docs/http/ngx_http_limit_req_module.xml @ 580:be54c443235a

Added copyright markers to documentation sources.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 10 Jul 2012 12:59:42 +0000
parents ebcb351d9eb3
children 764fbac1b8b4
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: 179
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_req_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_req_module.html"
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
12 lang="en">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
13
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14 <section id="summary">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16 <para>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
17 The <literal>ngx_http_limit_req_module</literal> module (0.7.21) allows
529
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
18 to limit the request processing rate per defined key,
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
19 in particular, the processing rate of requests coming
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
20 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 The limitation is done using the “leaky bucket” method.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
22 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
23
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
24 </section>
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
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27 <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
28
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
29 <para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
30 <example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31 http {
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
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
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
36 server {
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 ...
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 location /search/ {
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 limit_req zone=one burst=5;
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 </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_req">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
52 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
53 <literal>zone</literal>=<value>name</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
54 [<literal>burst</literal>=<value>number</value>]
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
55 [<literal>nodelay</literal>]</syntax>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
56 <default/>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
57 <context>http</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
58 <context>server</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
59 <context>location</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
60
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
61 <para>
575
ebcb351d9eb3 Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents: 529
diff changeset
62 Sets a shared memory zone
ebcb351d9eb3 Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents: 529
diff changeset
63 and the maximum allowed burst of requests.
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
64 If the rate of requests exceeds the rate configured for a zone,
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
65 request processing is delayed such as that they are processed
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
66 at a defined rate.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
67 Excessive requests are delayed until their number exceeds the
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
68 defined number of bursts.
529
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
69 When exceeded, the request is terminated with an error
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
70 <http-status code="503" text="Service Temporarily Unavailable"/>.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
71 By default, the number of bursts is equal to zero.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
72 For example, the directives
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
73 <example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
74 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
75
351
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 288
diff changeset
76 server {
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 288
diff changeset
77 location /search/ {
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 288
diff changeset
78 limit_req zone=one burst=5;
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 288
diff changeset
79 }
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
80 </example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
81 allow not more than 1 request per second at an average,
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
82 with bursts not exceeding 5 requests.
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>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
86 If delaying of excessive requests while requests are being limited is not
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
87 desired, the parameter <literal>nodelay</literal> should be used:
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
88 <example>
351
a4fa80755eab Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents: 288
diff changeset
89 limit_req zone=one burst=5 nodelay;
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
90 </example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
91 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
92
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
93 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
94
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
95
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
96 <directive name="limit_req_log_level">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
97 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
98 <literal>info</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
99 <literal>notice</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
100 <literal>warn</literal> |
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
101 <literal>error</literal></syntax>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
102 <default>error</default>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
103 <context>http</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
104 <context>server</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
105 <context>location</context>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
106 <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
107
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
108 <para>
529
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
109 Sets the desired logging level
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
110 for cases when the server refuses to process requests
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
111 due to rate being exceeded,
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
112 or delays request processing.
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
113 Delays are logged with the level one less than refusals; for example,
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
114 if “<literal>limit_req_log_level notice</literal>” is specified,
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
115 delays are logged with the <literal>info</literal> level.
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
116 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
117
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
118 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
119
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 <directive name="limit_req_zone">
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
122 <syntax>
271
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
123 <value>$variable</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
124 <literal>zone</literal>=<value>name</value>:<value>size</value>
4c6d2c614d2c Cleaned up XML tag mess:
Ruslan Ermilov <ru@nginx.com>
parents: 270
diff changeset
125 <literal>rate</literal>=<value>rate</value></syntax>
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
126 <default/>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
127 <context>http</context>
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>
575
ebcb351d9eb3 Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents: 529
diff changeset
130 Sets parameters of a shared memory zone
ebcb351d9eb3 Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents: 529
diff changeset
131 that keeps states for various keys.
529
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
132 The state stores the current number of excessive requests in particular.
390
bef9e1a2e3c8 Documented the fact that empty values are not accounted in zones.
Ruslan Ermilov <ru@nginx.com>
parents: 351
diff changeset
133 The key is any non-empty value of the specified variable
509
0e55c9a48da9 Trimmed space at EOL.
Ruslan Ermilov <ru@nginx.com>
parents: 390
diff changeset
134 (empty values are not accounted).
288
b33d3f3cd8ca Removed terminal whitespace.
Ruslan Ermilov <ru@nginx.com>
parents: 271
diff changeset
135 Example usage:
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
136 <example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
137 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
138 </example>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
139 </para>
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 Here, the states are kept in a 10 megabyte zone “one”, and an
529
d477ae38c0bd Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents: 509
diff changeset
143 average request processing rate for this zone cannot exceed
179
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
144 1 request per second.
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 <para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
148 An IP address of the client serves as a key.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
149 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
150 <var>$binary_remote_addr</var> variable is used here,
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
151 allowing to lower the size of a state down to 64 bytes.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
152 One megabyte zone can keep about 16 thousand 64-byte states.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
153 If the storage for a zone is exhausted, the server will return error
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
154 <http-status code="503" text="Service Temporarily Unavailable"/>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
155 to all further requests.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
156 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
157
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
158 <para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
159 The rate is specified in requests per second (r/s).
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
160 If a rate of less than one request per second is desired,
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
161 it is specified in request per minute (r/m).
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
162 For example, half-request per second is 30r/m.
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
163 </para>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
164
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
165 </directive>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
166
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
167 </section>
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
168
8cc01e2179a9 - Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
169 </module>