comparison xml/en/docs/http/ngx_http_limit_conn_module.xml @ 179:8cc01e2179a9

- Reflected recent changes made to ngx_http_limit_conn_module. - Revamped documentation for ngx_http_limit_req_module. - Translated ngx_http_limit_{conn,req}_module into English.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 14 Nov 2011 18:09:03 +0000
parents
children 9e7d0c9c7eaa
comparison
equal deleted inserted replaced
178:65431179fb8f 179:8cc01e2179a9
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd">
4
5 <module name="Module ngx_http_limit_conn_module"
6 link="/en/docs/http/ngx_http_limit_conn_module.html"
7 lang="en">
8
9 <section id="summary">
10
11 <para>
12 The <code>ngx_http_limit_conn_module</code> module allows
13 to limit the number of connections per defined key, in
14 particular, the number of connections from a single IP address.
15 </para>
16
17 <para>
18 Not all connections are counted; only those that have requests
19 currently being processed by the server, in which request header has
20 been fully read.
21 </para>
22
23 </section>
24
25
26 <section id="example" name="Example Configuration">
27
28 <para>
29 <example>
30 http {
31 limit_conn_zone $binary_remote_addr zone=addr:10m;
32
33 ...
34
35 server {
36
37 ...
38
39 location /download/ {
40 limit_conn addr 1;
41 }
42 </example>
43 </para>
44
45 </section>
46
47
48 <section id="directives" name="Directives">
49
50 <directive name="limit_conn">
51 <syntax><argument>zone number</argument></syntax>
52 <default/>
53 <context>http</context>
54 <context>server</context>
55 <context>location</context>
56
57 <para>
58 Sets the maximum allowed number of connections for a given key value.
59 When this limit is exceeded, the server will return error
60 <http-status code="503" text="Service Temporarily Unavailable"/>
61 in reply to a request.
62 For example, the directives
63 <example>
64 limit_conn_zone $binary_remote_addr zone=addr:10m;
65
66 server {
67 location /download/ {
68 limit_conn addr 1;
69 }
70 </example>
71 allow for only a single connection at a time, per unique IP address.
72 </para>
73
74 <para>
75 When several <code>limit_conn</code> directives are specified,
76 any configured limit will apply.
77 </para>
78
79 <para>
80 These directives are inherited from the previous level if and
81 only if there are no
82 <code>limit_conn</code>
83 directives on the current level.
84 </para>
85
86 </directive>
87
88
89 <directive name="limit_conn_log_level">
90 <syntax>
91 <value>info</value> |
92 <value>notice</value> |
93 <value>warn</value> |
94 <value>error</value>
95 </syntax>
96 <default>error</default>
97 <context>http</context>
98 <context>server</context>
99 <context>location</context>
100 <appeared-in>0.8.18</appeared-in>
101
102 <para>
103 Sets the desired logging level for cases when the server
104 limits the number of connections.
105 </para>
106
107 </directive>
108
109
110 <directive name="limit_conn_zone">
111 <syntax>
112 <argument>$variable </argument>
113 <parameter>zone</parameter>=<argument>name</argument>:<argument>size</argument>
114 </syntax>
115 <default/>
116 <context>http</context>
117
118 <para>
119 Sets the parameters for a zone that keeps states for various keys.
120 This state stores the current number of connections in particular.
121 The key is the value of the specified variable.
122 Example usage:
123 <example>
124 limit_conn_zone $binary_remote_addr zone=addr:10m;
125 </example>
126 Here, an IP address of the client serves as a key.
127 Note that instead of <var>$remote_addr</var>, the
128 <var>$binary_remote_addr</var> variable is used here.
129 The length of the <var>$remote_addr</var> variable's value can
130 range from 7 to 15 bytes, and the stored state occupies either
131 32 or 64 bytes of memory on 32-bit platforms, and always 64
132 bytes on 64-bit platforms.
133 The length of the <var>$binary_remote_addr</var> variable's value
134 is always 4 bytes, and the stored state always occupies 32 bytes
135 on 32-bit platforms, and 64 bytes on 64-bit platforms.
136 One megabyte zone can keep about 32 thousand 32-bit states,
137 and about 16 thousand 64-byte states.
138 If the storage for a zone is exhausted, the server will return error
139 <http-status code="503" text="Service Temporarily Unavailable"/>
140 to all further requests.
141 </para>
142
143 </directive>
144
145 <directive name="limit_zone">
146 <syntax><argument>$variable name size</argument></syntax>
147 <default/>
148 <context>http</context>
149
150 <para>
151 This directive is made obsolete in version 1.1.8,
152 the <link id="limit_conn_zone"/> directive should be used instead.
153 </para>
154
155 </directive>
156
157 </section>
158
159 </module>