Mercurial > hg > nginx-site
annotate xml/ru/docs/stream/ngx_stream_geo_module.xml @ 2895:9708787aafc7
Updated with Netcraft September 2022 Web Server Survey stats.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Fri, 30 Sep 2022 16:45:20 +0100 |
parents | 71e505ea3cb3 |
children |
rev | line source |
---|---|
222
bfe3eff81d04
Removed redundant encoding specification.
Ruslan Ermilov <ru@nginx.com>
parents:
110
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:
523
diff
changeset
|
3 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
5 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
6 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
9 <module name="Модуль ngx_stream_geo_module" |
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
10 link="/ru/docs/stream/ngx_stream_geo_module.html" |
589 | 11 lang="ru" |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
12 rev="1"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 |
110
40eec261c2a6
Added proper support for anonymous sections, notably for the summary.
Ruslan Ermilov <ru@nginx.com>
parents:
108
diff
changeset
|
14 <section id="summary"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 <para> |
2284
71e505ea3cb3
Fixed cut&paste error in Russian translation of stream modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1751
diff
changeset
|
17 Модуль <literal>ngx_stream_geo_module</literal> (1.11.3) создаёт переменные, |
366 | 18 значения которых зависят от IP-адреса клиента. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
366 | 24 <section id="example" name="Пример конфигурации"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 <example> |
366 | 28 geo $geo { |
29 default 0; | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
30 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
31 127.0.0.1 2; |
366 | 32 192.168.1.0/24 1; |
33 10.1.0.0/16 1; | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
34 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
35 ::1 2; |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
36 2001:0db8::/32 1; |
366 | 37 } |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 </para> |
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 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 |
366 | 44 <section id="directives" name="Директивы"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 <directive name="geo"> |
271 | 47 <syntax block="yes">[<value>$адрес</value>] <value>$переменная</value></syntax> |
99
1d315ef37215
The case <default/> is now language-agnostic.
Ruslan Ermilov <ru@nginx.com>
parents:
76
diff
changeset
|
48 <default/> |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
49 <context>stream</context> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 <para> |
366 | 52 Описывает для указанной переменной зависимость значения от |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 IP-адреса клиента. |
366 | 54 По умолчанию адрес берётся из переменной <var>$remote_addr</var>, |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
55 но его также можно получить из другой переменной, например: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 <example> |
366 | 57 geo $arg_remote_addr $geo { |
58 ...; | |
59 } | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 </example> |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
61 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
62 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
63 <para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
64 <note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
65 Поскольку переменные вычисляются только в момент использования, |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
66 само по себе наличие даже большого числа объявлений переменных |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
67 “<literal>geo</literal>” не влечёт за собой никаких дополнительных |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
68 расходов на обработку соединений. |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
69 </note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
70 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
71 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
72 <para> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 Если значение переменной не представляет из себя правильный IP-адрес, |
366 | 74 то используется адрес “<literal>255.255.255.255</literal>”. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 </para> |
366 | 76 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 <para> |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
78 Адреса задаются либо префиксами в формате CIDR |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
79 (включая одиночные адреса), либо в виде диапазонов. |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
80 </para> |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
81 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
82 <para> |
518 | 83 Также поддерживаются следующие специальные параметры: |
366 | 84 <list type="tag"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 |
366 | 86 <tag-name><literal>delete</literal></tag-name> |
87 <tag-desc> | |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
88 удаляет описанную сеть. |
366 | 89 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 |
366 | 91 <tag-name><literal>default</literal></tag-name> |
92 <tag-desc> | |
93 значение переменной, если адрес клиента не соответствует | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
94 ни одному из заданных адресов. |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
95 При задании адресов в формате CIDR |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
96 вместо <literal>default</literal> можно использовать |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
97 “<literal>0.0.0.0/0</literal>” и “<literal>::/0</literal>”. |
788
753ed7df8910
Documented what will be the default value of "geo" if "default" isn't set.
Ruslan Ermilov <ru@nginx.com>
parents:
716
diff
changeset
|
98 Если параметр <literal>default</literal> не указан, значением |
753ed7df8910
Documented what will be the default value of "geo" if "default" isn't set.
Ruslan Ermilov <ru@nginx.com>
parents:
716
diff
changeset
|
99 по умолчанию будет пустая строка. |
366 | 100 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
366 | 102 <tag-name><literal>include</literal></tag-name> |
103 <tag-desc> | |
104 включает файл с адресами и значениями. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 Включений может быть несколько. |
366 | 106 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 |
366 | 108 <tag-name><literal>ranges</literal></tag-name> |
109 <tag-desc> | |
1751
3768eb3d9c6c
Documented the geo module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
840
diff
changeset
|
110 указывает, что адреса задаются в виде диапазонов. |
366 | 111 Этот параметр должен быть первым. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 Для ускорения загрузки гео-базы нужно располагать адреса в порядке возрастания. |
366 | 113 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 </list> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 <para> |
366 | 119 Пример: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 <example> |
366 | 121 geo $country { |
122 default ZZ; | |
123 include conf/geo.conf; | |
124 delete 127.0.0.0/16; | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 |
366 | 126 127.0.0.0/24 US; |
127 127.0.0.1/32 RU; | |
128 10.1.0.0/16 RU; | |
129 192.168.1.0/24 UK; | |
130 } | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 <para> |
366 | 135 В файле <path>conf/geo.conf</path> могут быть такие строки: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 <example> |
366 | 137 10.2.0.0/16 RU; |
138 192.168.2.0/24 RU; | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 В качестве значения выбирается максимальное совпадение, например, |
366 | 144 для адреса 127.0.0.1 будет выбрано значение “<literal>RU</literal>”, |
145 а не “<literal>US</literal>”. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 Пример описания диапазонов: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
150 <example> |
366 | 151 geo $country { |
152 ranges; | |
153 default ZZ; | |
154 127.0.0.0-127.0.0.0 US; | |
155 127.0.0.1-127.0.0.1 RU; | |
368 | 156 127.0.0.2-127.0.0.255 US; |
366 | 157 10.1.0.0-10.1.255.255 RU; |
158 192.168.1.0-192.168.1.255 UK; | |
159 } | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 </section> |
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 </module> |