Mercurial > hg > nginx-site
annotate xml/ru/docs/http/ngx_http_geo_module.xml @ 3039:e6b785b7e308
Minor fixes in njs documentation.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 06 Feb 2024 08:52:52 +0000 |
parents | 9dab69f2b71d |
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) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
6 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
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 |
366 | 10 <module name="Модуль ngx_http_geo_module" |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 link="/ru/docs/http/ngx_http_geo_module.html" |
589 | 12 lang="ru" |
840
9dab69f2b71d
Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents:
797
diff
changeset
|
13 rev="5"> |
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:
108
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> |
366 | 18 Модуль <literal>ngx_http_geo_module</literal> создаёт переменные, |
19 значения которых зависят от IP-адреса клиента. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 |
366 | 25 <section id="example" name="Пример конфигурации"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 <example> |
366 | 29 geo $geo { |
30 default 0; | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
31 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
32 127.0.0.1 2; |
366 | 33 192.168.1.0/24 1; |
34 10.1.0.0/16 1; | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
35 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
36 ::1 2; |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
37 2001:0db8::/32 1; |
366 | 38 } |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 </section> |
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 |
366 | 45 <section id="directives" name="Директивы"> |
76
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 <directive name="geo"> |
271 | 48 <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
|
49 <default/> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 <context>http</context> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 <para> |
366 | 53 Описывает для указанной переменной зависимость значения от |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 IP-адреса клиента. |
366 | 55 По умолчанию адрес берётся из переменной <var>$remote_addr</var>, |
56 но его также можно получить из другой переменной (0.7.27), например: | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 <example> |
366 | 58 geo $arg_remote_addr $geo { |
59 ...; | |
60 } | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 </example> |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
62 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
63 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
64 <para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
65 <note> |
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 само по себе наличие даже большого числа объявлений переменных |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
68 “<literal>geo</literal>” не влечёт за собой никаких дополнительных |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
69 расходов на обработку запросов. |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
70 </note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
71 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
72 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
73 <para> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 Если значение переменной не представляет из себя правильный IP-адрес, |
366 | 75 то используется адрес “<literal>255.255.255.255</literal>”. |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 </para> |
366 | 77 |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 <para> |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
79 Адреса задаются либо префиксами в формате CIDR |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
80 (включая одиночные адреса), либо в виде диапазонов (0.7.23). |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
81 <note> |
840
9dab69f2b71d
Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents:
797
diff
changeset
|
82 IPv6-префиксы поддерживаются начиная с версий 1.3.10 и 1.2.7. |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
83 </note> |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
84 </para> |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
85 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
86 <para> |
518 | 87 Также поддерживаются следующие специальные параметры: |
366 | 88 <list type="tag"> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 |
366 | 90 <tag-name><literal>delete</literal></tag-name> |
91 <tag-desc> | |
92 удаляет описанную сеть (0.7.23). | |
93 </tag-desc> | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 |
366 | 95 <tag-name><literal>default</literal></tag-name> |
96 <tag-desc> | |
97 значение переменной, если адрес клиента не соответствует | |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
98 ни одному из заданных адресов. |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
99 При задании адресов в формате CIDR |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
100 вместо <literal>default</literal> можно использовать |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
101 “<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
|
102 Если параметр <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
|
103 по умолчанию будет пустая строка. |
366 | 104 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 |
366 | 106 <tag-name><literal>include</literal></tag-name> |
107 <tag-desc> | |
108 включает файл с адресами и значениями. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 Включений может быть несколько. |
366 | 110 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 |
366 | 112 <tag-name><literal>proxy</literal></tag-name> |
113 <tag-desc> | |
518 | 114 задаёт доверенные адреса (0.8.7, 0.7.63), |
368 | 115 при запросе с которых будет использоваться адрес в переданном |
116 поле заголовка запроса <header>X-Forwarded-For</header>. | |
518 | 117 В отличие от обычных адресов, доверенные адреса проверяются |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 последовательно. |
518 | 119 <note> |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
120 Доверенные IPv6-адреса поддерживаются начиная с версий 1.3.0 и 1.2.1. |
518 | 121 </note> |
122 </tag-desc> | |
123 | |
124 <tag-name><literal>proxy_recursive</literal></tag-name> | |
125 <tag-desc> | |
523 | 126 включает рекурсивный поиск адреса (1.3.0, 1.2.1). |
518 | 127 При выключенном рекурсивном поиске вместо исходного адреса клиента, |
128 совпадающего с одним из доверенных адресов, будет использоваться последний | |
129 адрес, переданный в <header>X-Forwarded-For</header>. | |
130 При включённом рекурсивном поиске вместо исходного адреса клиента, | |
131 совпадающего с одним из доверенных адресов, будет использоваться последний | |
132 не доверенный адрес, переданный в <header>X-Forwarded-For</header>. | |
366 | 133 </tag-desc> |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 |
366 | 135 <tag-name><literal>ranges</literal></tag-name> |
136 <tag-desc> | |
137 указывает, что адреса задаются в виде диапазонов (0.7.23). | |
138 Этот параметр должен быть первым. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 Для ускорения загрузки гео-базы нужно располагать адреса в порядке возрастания. |
366 | 140 </tag-desc> |
76
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 </list> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 <para> |
366 | 146 Пример: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 <example> |
366 | 148 geo $country { |
149 default ZZ; | |
150 include conf/geo.conf; | |
151 delete 127.0.0.0/16; | |
152 proxy 192.168.100.0/24; | |
518 | 153 proxy 2001:0db8::/32; |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 |
366 | 155 127.0.0.0/24 US; |
156 127.0.0.1/32 RU; | |
157 10.1.0.0/16 RU; | |
158 192.168.1.0/24 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 <para> |
366 | 164 В файле <path>conf/geo.conf</path> могут быть такие строки: |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 <example> |
366 | 166 10.2.0.0/16 RU; |
167 192.168.2.0/24 RU; | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
171 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
172 В качестве значения выбирается максимальное совпадение, например, |
366 | 173 для адреса 127.0.0.1 будет выбрано значение “<literal>RU</literal>”, |
174 а не “<literal>US</literal>”. | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
175 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 <para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
178 Пример описания диапазонов: |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
179 <example> |
366 | 180 geo $country { |
181 ranges; | |
182 default ZZ; | |
183 127.0.0.0-127.0.0.0 US; | |
184 127.0.0.1-127.0.0.1 RU; | |
368 | 185 127.0.0.2-127.0.0.255 US; |
366 | 186 10.1.0.0-10.1.255.255 RU; |
187 192.168.1.0-192.168.1.255 UK; | |
188 } | |
76
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 </example> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 </para> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 </directive> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 </section> |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 |
4a4caa566120
Russian documentation import.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 </module> |