Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_limit_req_module.xml @ 1867:e42f6c54ea5f
Added ES7 exponentiation operators support to "About nginScript".
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 20 Dec 2016 16:05:31 +0300 |
parents | 6c96a644b0b3 |
children | 469aebbd94d0 |
rev | line source |
---|---|
222
bfe3eff81d04
Removed redundant encoding specification.
Ruslan Ermilov <ru@nginx.com>
parents:
179
diff
changeset
|
1 <?xml version="1.0"?> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
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 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
10 <module name="Модуль ngx_http_limit_req_module" |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 link="/ru/docs/http/ngx_http_limit_req_module.html" |
589 | 12 lang="ru" |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
13 rev="6"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 |
110
40eec261c2a6
Added proper support for anonymous sections, notably for the summary.
Ruslan Ermilov <ru@nginx.com>
parents:
102
diff
changeset
|
15 <section id="summary"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 <para> |
271 | 18 Модуль <literal>ngx_http_limit_req_module</literal> (0.7.21) позволяет |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
19 ограничить скорость обработки запросов по заданному ключу или, |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
20 как частный случай, скорость обработки запросов, поступающих |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
21 с одного IP-адреса. |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
22 Ограничение обеспечивается с помощью метода “leaky bucket”. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 |
364 | 27 |
28 <section id="example" name="Пример конфигурации"> | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 <example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 http { |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
33 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 ... |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 server { |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 ... |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 location /search/ { |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
42 limit_req zone=one burst=5; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 } |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
48 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
49 |
364 | 50 <section id="directives" name="Директивы"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
52 <directive name="limit_req"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
53 <syntax> |
271 | 54 <literal>zone</literal>=<value>название</value> |
55 [<literal>burst</literal>=<value>число</value>] | |
56 [<literal>nodelay</literal>]</syntax> | |
99
1d315ef37215
The case <default/> is now language-agnostic.
Ruslan Ermilov <ru@nginx.com>
parents:
76
diff
changeset
|
57 <default/> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 <context>http</context> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
59 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
60 <context>location</context> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 <para> |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
529
diff
changeset
|
63 Задаёт зону разделяемой памяти (<literal>zone</literal>) |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
64 и максимальный размер всплеска запросов (<literal>burst</literal>). |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
65 Если скорость поступления запросов превышает описанную в зоне, |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
66 то их обработка задерживается так, чтобы запросы обрабатывались |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 с заданной скоростью. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 Избыточные запросы задерживаются до тех пор, пока их число |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
69 не превысит максимальный размер всплеска. |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
70 При превышении запрос завершается с ошибкой |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
71 <http-status code="503" text="Service Temporarily Unavailable"/>. |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
72 По умолчанию максимальный размер всплеска равен нулю. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 Например, директивы |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 <example> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
75 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
77 server { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
78 location /search/ { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
79 limit_req zone=one burst=5; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
80 } |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 позволяют в среднем не более 1 запроса в секунду |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 со всплесками не более 5 запросов. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 Если же избыточные запросы в пределах лимита всплесков задерживать |
271 | 88 не требуется, то следует использовать параметр <literal>nodelay</literal>: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 <example> |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
90 limit_req zone=one burst=5 nodelay; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 |
1629
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
94 <para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
95 Директив <literal>limit_req</literal> может быть несколько. |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
96 Например, следующая конфигурация ограничивает скорость обработки запросов, |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
97 поступающих с одного IP-адреса, и в то же время ограничивает |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
98 скорость обработки запросов одним виртуальным сервером: |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
99 <example> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
100 limit_req_zone $binary_remote_addr zone=perip:10m rate=1r/s; |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
101 limit_req_zone $server_name zone=perserver:10m rate=10r/s; |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
102 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
103 server { |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
104 ... |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
105 limit_req zone=perip burst=5 nodelay; |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
106 limit_req zone=perserver burst=10; |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
107 } |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
108 </example> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
109 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
110 </para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
111 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
112 <para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
113 Директивы наследуются с предыдущего уровня при условии, что на данном уровне |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
114 не описаны свои директивы <literal>limit_req</literal>. |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
115 </para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
116 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 <directive name="limit_req_log_level"> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
121 <syntax> |
271 | 122 <literal>info</literal> | |
123 <literal>notice</literal> | | |
124 <literal>warn</literal> | | |
125 <literal>error</literal></syntax> | |
102
c76a257f3fd4
The directive name is now automatically printed in <default> and <syntax>.
Ruslan Ermilov <ru@nginx.com>
parents:
99
diff
changeset
|
126 <default>error</default> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
127 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
128 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
129 <context>location</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
130 <appeared-in>0.8.18</appeared-in> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
131 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
132 <para> |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
133 Задаёт желаемый уровень записи в лог |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
134 случаев отказа в обработке запросов при превышении скорости |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
135 и случаев задержек при обработке запроса. |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
136 Задержки записываются в лог с уровнем на единицу меньшим, чем отказы, |
271 | 137 например, если указано “<literal>limit_req_log_level notice</literal>”, |
138 то задержки будут записываться в лог на уровне <literal>info</literal>. | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
139 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
140 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
141 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
142 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
143 |
870
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
144 <directive name="limit_req_status"> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
145 <syntax><value>код</value></syntax> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
146 <default>503</default> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
147 <context>http</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
148 <context>server</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
149 <context>location</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
150 <appeared-in>1.3.15</appeared-in> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
151 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
152 <para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
153 Позволяет переопределить код ответа, используемый при отклонении запросов. |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
154 </para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
155 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
156 </directive> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
157 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
158 |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
159 <directive name="limit_req_zone"> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
160 <syntax> |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
161 <value>ключ</value> |
271 | 162 <literal>zone</literal>=<value>название</value>:<value>размер</value> |
163 <literal>rate</literal>=<value>скорость</value></syntax> | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
164 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
165 <context>http</context> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 <para> |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
529
diff
changeset
|
168 Задаёт параметры зоны разделяемой памяти, |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
169 которая хранит состояние для разных значений ключа. |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
170 Состояние в частности хранит текущее число избыточных запросов. |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
171 В качестве ключа можно использовать текст, переменные и их комбинации. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
172 Запросы с пустым значением ключа не учитываются. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
173 <note> |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
174 До версии 1.7.6 в качестве ключа можно было задать ровно одну переменную. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
175 </note> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
176 Пример использования: |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
177 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
178 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:
110
diff
changeset
|
179 </example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
180 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
181 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
182 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
183 В данном случае состояния хранятся в зоне “one” размером 10 мегабайт, |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
184 и средняя скорость обработки запросов для этой зоны не может превышать |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
185 1 запроса в секунду. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
186 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
187 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
188 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
189 В качестве ключа используется IP-адрес клиента. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
190 Обратите внимание, что вместо переменной <var>$remote_addr</var> используется |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
191 переменная <var>$binary_remote_addr</var>. |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
192 Длина значения переменной <var>$binary_remote_addr</var> всегда |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
193 равна 4 байтам для IPv4-адресов или 16 байтам для IPv6-адресов. |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
194 При этом размер состояния всегда равен |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
195 64 байтам на 32-битных платформах и 128 байтам на 64-битных платформах. |
367
f4033b9bc4ec
- Removed unnecessary instances of unbreakable space.
Ruslan Ermilov <ru@nginx.com>
parents:
364
diff
changeset
|
196 В зоне размером 1 мегабайт может разместиться около 16 тысяч состояний |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
197 размером 64 байта или около 8 тысяч состояний размером 128 байт. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
198 При переполнении зоны в ответ на последующие запросы сервер будет |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
199 возвращать ошибку |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
200 <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:
110
diff
changeset
|
201 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
202 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
203 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
204 Скорость задаётся в запросах в секунду (r/s). |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
205 Если же нужна скорость меньше одного запроса в секунду, |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
206 то она задаётся в запросах в минуту (r/m), например, |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
207 ползапроса в секунду — это 30r/m. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
210 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
214 </module> |