Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_limit_req_module.xml @ 3054:0083dce686ec
Free nginx: repository links.
Repositories are now under freenginx.org/hg/. Only essential repositories
are preserved for now: in particular, dev examples are no longer provided,
so the relevant section from the devguide was removed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 14 Feb 2024 20:07:38 +0300 |
parents | 9eadb98ec770 |
children |
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" |
3043
9eadb98ec770
Free nginx: removed commercial version documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2593
diff
changeset
|
13 rev="17"> |
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>] | |
2291
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
56 [<literal>nodelay</literal> | |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
57 <literal>delay</literal>=<value>число</value>]</syntax> |
99
1d315ef37215
The case <default/> is now language-agnostic.
Ruslan Ermilov <ru@nginx.com>
parents:
76
diff
changeset
|
58 <default/> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 <context>http</context> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
60 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
61 <context>location</context> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 <para> |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
529
diff
changeset
|
64 Задаёт зону разделяемой памяти (<literal>zone</literal>) |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
65 и максимальный размер всплеска запросов (<literal>burst</literal>). |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
66 Если скорость поступления запросов превышает описанную в зоне, |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
67 то их обработка задерживается так, чтобы запросы обрабатывались |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 с заданной скоростью. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 Избыточные запросы задерживаются до тех пор, пока их число |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
70 не превысит максимальный размер всплеска. |
2013
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
71 При превышении запрос завершается с |
469aebbd94d0
Limit_req/limit_conn may return not only 503 on failure.
Ruslan Ermilov <ru@nginx.com>
parents:
1699
diff
changeset
|
72 <link id="limit_req_status">ошибкой</link>. |
816
c711c50bdcf4
limit_req: clarified the description of the burst= parameter.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
73 По умолчанию максимальный размер всплеска равен нулю. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 Например, директивы |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 <example> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
76 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
|
77 |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
78 server { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
79 location /search/ { |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
80 limit_req zone=one burst=5; |
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
81 } |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 позволяют в среднем не более 1 запроса в секунду |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 со всплесками не более 5 запросов. |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 Если же избыточные запросы в пределах лимита всплесков задерживать |
271 | 89 не требуется, то следует использовать параметр <literal>nodelay</literal>: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 <example> |
351
a4fa80755eab
Consistently strip initial offset in examples.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
91 limit_req zone=one burst=5 nodelay; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 |
2291
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
95 <para id="limit_req_delay"> |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
96 Параметр <literal>delay</literal> (1.15.7) задаёт лимит, |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
97 по достижении которого избыточные запросы задерживаются. |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
98 Значение по умолчанию равно нулю и означает, |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
99 что задерживаются все избыточные запросы. |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
100 </para> |
3294470932c5
Documented the "delay" parameter for limit_req.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2230
diff
changeset
|
101 |
1629
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
102 <para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
103 Директив <literal>limit_req</literal> может быть несколько. |
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 поступающих с одного IP-адреса, и в то же время ограничивает |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
106 скорость обработки запросов одним виртуальным сервером: |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
107 <example> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
108 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
|
109 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
|
110 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
111 server { |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
112 ... |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
113 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
|
114 limit_req zone=perserver burst=10; |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
115 } |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
116 </example> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
117 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
118 </para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
119 |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
120 <para> |
2593
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2512
diff
changeset
|
121 Директивы наследуются с предыдущего уровня конфигурации при условии, что |
eeed494bba51
Unified phrases about configuration levels and inheritance.
Ruslan Ermilov <ru@nginx.com>
parents:
2512
diff
changeset
|
122 на данном уровне не описаны свои директивы <literal>limit_req</literal>. |
1629
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
123 </para> |
7945dac7ad47
Documented multiple limit_req support and inheritance rules.
Ruslan Ermilov <ru@nginx.com>
parents:
1320
diff
changeset
|
124 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
2400
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
128 <directive name="limit_req_dry_run"> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
129 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
2449
384211f17f5a
Fixed default value for limit_req_dry_run.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2400
diff
changeset
|
130 <default>off</default> |
2400
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
131 <context>http</context> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
132 <context>server</context> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
133 <context>location</context> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
134 <appeared-in>1.17.1</appeared-in> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
135 |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
136 <para> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
137 Включает режим пробного запуска. |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
138 В данном режиме скорость обработки запросов не ограничивается, однако |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
139 в зоне разделяемой памяти текущее число избыточных запросов учитывается |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
140 как обычно. |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
141 </para> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
142 |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
143 </directive> |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
144 |
f86b5961e9b8
Documented the limit_req_dry_run directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2291
diff
changeset
|
145 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 <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
|
147 <syntax> |
271 | 148 <literal>info</literal> | |
149 <literal>notice</literal> | | |
150 <literal>warn</literal> | | |
151 <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
|
152 <default>error</default> |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
153 <context>http</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
154 <context>server</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
155 <context>location</context> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
156 <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
|
157 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
158 <para> |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
159 Задаёт желаемый уровень записи в лог |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
160 случаев отказа в обработке запросов при превышении скорости |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
161 и случаев задержек при обработке запроса. |
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
162 Задержки записываются в лог с уровнем на единицу меньшим, чем отказы, |
271 | 163 например, если указано “<literal>limit_req_log_level notice</literal>”, |
164 то задержки будут записываться в лог на уровне <literal>info</literal>. | |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
165 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
166 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
167 </directive> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
168 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
169 |
870
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
170 <directive name="limit_req_status"> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
171 <syntax><value>код</value></syntax> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
172 <default>503</default> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
173 <context>http</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
174 <context>server</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
175 <context>location</context> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
176 <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
|
177 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
178 <para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
179 Позволяет переопределить код ответа, используемый при отклонении запросов. |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
180 </para> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
181 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
182 </directive> |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
diff
changeset
|
183 |
6087d3fa6919
The limit_req_status and limit_conn_status directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
816
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 <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
|
186 <syntax> |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
187 <value>ключ</value> |
271 | 188 <literal>zone</literal>=<value>название</value>:<value>размер</value> |
3043
9eadb98ec770
Free nginx: removed commercial version documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2593
diff
changeset
|
189 <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
|
190 <default/> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
191 <context>http</context> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 <para> |
575
ebcb351d9eb3
Consistently using the term "shared memory zone".
Ruslan Ermilov <ru@nginx.com>
parents:
529
diff
changeset
|
194 Задаёт параметры зоны разделяемой памяти, |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
195 которая хранит состояние для разных значений ключа. |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
196 Состояние в частности хранит текущее число избыточных запросов. |
1320
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
197 В качестве ключа можно использовать текст, переменные и их комбинации. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
198 Запросы с пустым значением ключа не учитываются. |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
199 <note> |
f15a983cac66
Limit conn/req: key is no longer limited to only one variable.
Ruslan Ermilov <ru@nginx.com>
parents:
870
diff
changeset
|
200 До версии 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
|
201 </note> |
179
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 <example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
204 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
|
205 </example> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
206 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
207 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
208 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
209 В данном случае состояния хранятся в зоне “one” размером 10 мегабайт, |
529
d477ae38c0bd
Clarified on what this module actually limits.
Ruslan Ermilov <ru@nginx.com>
parents:
390
diff
changeset
|
210 и средняя скорость обработки запросов для этой зоны не может превышать |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
211 1 запроса в секунду. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
212 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
213 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
214 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
215 В качестве ключа используется IP-адрес клиента. |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
216 Обратите внимание, что вместо переменной <var>$remote_addr</var> используется |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
217 переменная <var>$binary_remote_addr</var>. |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
218 Длина значения переменной <var>$binary_remote_addr</var> всегда |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
219 равна 4 байтам для IPv4-адресов или 16 байтам для IPv6-адресов. |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
220 При этом размер состояния всегда равен |
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
221 64 байтам на 32-битных платформах и 128 байтам на 64-битных платформах. |
367
f4033b9bc4ec
- Removed unnecessary instances of unbreakable space.
Ruslan Ermilov <ru@nginx.com>
parents:
364
diff
changeset
|
222 В зоне размером 1 мегабайт может разместиться около 16 тысяч состояний |
1699
6c96a644b0b3
Corrected description of $binary_remote_addr and saved state.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1629
diff
changeset
|
223 размером 64 байта или около 8 тысяч состояний размером 128 байт. |
2014
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
224 </para> |
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
225 |
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
226 <para> |
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
227 При переполнении зоны удаляется наименее востребованное состояние. |
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
228 Если и это не позволяет создать новое состояние, запрос завершается с |
6e66487c5756
Limit_req: document what happens on zone exhaustion (ticket #1133)
Ruslan Ermilov <ru@nginx.com>
parents:
2013
diff
changeset
|
229 <link id="limit_req_status">ошибкой</link>. |
179
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
230 </para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
231 |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
232 <para> |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
233 Скорость задаётся в запросах в секунду (r/s). |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
234 Если же нужна скорость меньше одного запроса в секунду, |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
235 то она задаётся в запросах в минуту (r/m), например, |
8cc01e2179a9
- Reflected recent changes made to ngx_http_limit_conn_module.
Ruslan Ermilov <ru@nginx.com>
parents:
110
diff
changeset
|
236 ползапроса в секунду — это 30r/m. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
237 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
239 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
240 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
241 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 |
2462
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
243 |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
244 <section id="variables" name="Встроенные переменные"> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
245 |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
246 <para> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
247 <list type="tag"> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
248 |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
249 <tag-name id="var_limit_req_status"><var>$limit_req_status</var></tag-name> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
250 <tag-desc> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
251 хранит результат ограничения скорости поступления запросов (1.17.6): |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
252 <literal>PASSED</literal>, |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
253 <literal>DELAYED</literal>, |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
254 <literal>REJECTED</literal>, |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
255 <literal>DELAYED_DRY_RUN</literal> или |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
256 <literal>REJECTED_DRY_RUN</literal> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
257 </tag-desc> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
258 |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
259 </list> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
260 </para> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
261 |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
262 </section> |
63a2a3dc3d63
Documented the $limit_req_status variable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2449
diff
changeset
|
263 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
264 </module> |