Mercurial > hg > nginx-site
comparison xml/ru/docs/http/ngx_http_geo_module.xml @ 76:4a4caa566120
Russian documentation import.
Changes in module.dtd: <example> now allowed to contain <value> and
<emphasis> elements (we need this to show important parts in examples),
less strict checking of <directive> syntax (we don't want to fully
document some directives, notably deprecated ones).
Known issues:
1. <syntax> elements are preserved as is, they will require manual conversion
(likely to some not-yet-existed format a la DocBook cmdsynopsis, as
currently used one seems to be incomplete);
2. <value> no longer corresponds to replaceable content, and it's use in
examples isn't correct;
3. <link doc="document#fragment"> doesn't work with current xslt, either
should be supported or changed to <link doc="document" id="fragment">.
The following files are intentionally omitted: maillists.xml (support.xml
should be used instead), experimental.xml (obsolete), faq.xml (conflicts
with existing one, needs discussion).
Not yet linked to site.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 11 Oct 2011 12:57:50 +0000 |
parents | |
children | 1d315ef37215 |
comparison
equal
deleted
inserted
replaced
75:2bf4cd2787c5 | 76:4a4caa566120 |
---|---|
1 <?xml version="1.0" encoding="utf-8"?> | |
2 | |
3 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | |
4 | |
5 <module name="Директивы модуля ngx_http_geo_module" | |
6 link="/ru/docs/http/ngx_http_geo_module.html" | |
7 lang="ru"> | |
8 | |
9 <section name="" id="summary"> | |
10 | |
11 <para> | |
12 Модуль ngx_http_geo_module создаёт переменные, значения которых | |
13 зависят от IP-адреса клиента. | |
14 </para> | |
15 | |
16 </section> | |
17 | |
18 | |
19 <section name="Пример конфигурации" id="example"> | |
20 | |
21 <para> | |
22 <example> | |
23 geo $geo { | |
24 default 0; | |
25 127.0.0.1/32 2; | |
26 192.168.1.0/24 1; | |
27 10.1.0.0/16 1; | |
28 } | |
29 </example> | |
30 </para> | |
31 | |
32 </section> | |
33 | |
34 | |
35 <section name="Директивы" id="directives"> | |
36 | |
37 <directive name="geo"> | |
38 <syntax>geo <value>[$адрес] $переменная { ... }</value> | |
39 </syntax> | |
40 <default>нет</default> | |
41 <context>http</context> | |
42 | |
43 <para> | |
44 Директива geo описывает для указанной переменной зависимость значения от | |
45 IP-адреса клиента. | |
46 По умолчанию адрес берётся из переменной $remote_addr, но его также (0.7.27) | |
47 можно получить из другой переменной, например: | |
48 <example> | |
49 geo $arg_remote_addr $geo { | |
50 ...; | |
51 } | |
52 </example> | |
53 Если значение переменной не представляет из себя правильный IP-адрес, | |
54 то используется адрес "255.255.255.255". | |
55 </para> | |
56 <para> | |
57 Адреса задаются в виде CIDR или в виде диапазонов (0.7.23). | |
58 Кроме того, есть четыре специальных параметра: | |
59 <list type="bullet"> | |
60 | |
61 <listitem> | |
62 delete — удаляет описанную сеть (0.7.23). | |
63 </listitem> | |
64 | |
65 <listitem> | |
66 default — значение переменной, если адрес клиента не соответствует | |
67 ни одному заданному адресу. | |
68 При использовании CIDR вместо default можно также написать 0.0.0.0/0. | |
69 </listitem> | |
70 | |
71 <listitem> | |
72 include — включает файл с адресами и значениями. | |
73 Включений может быть несколько. | |
74 </listitem> | |
75 | |
76 <listitem> | |
77 proxy — задаёт адреса проски-серверов (0.8.7, 0.7.63), | |
78 при запросе с которых будет использоваться адрес в переданной | |
79 в строке заголовка запроса "X-Forwarded-For". | |
80 В отличие от обычных адресов, адреса прокси-серверов проверяются | |
81 последовательно. | |
82 </listitem> | |
83 | |
84 <listitem> | |
85 ranges — указывает, что адреса задаются в виде диапазонов (0.7.23). | |
86 Эта директива должны быть первой. | |
87 Для ускорения загрузки гео-базы нужно располагать адреса в порядке возрастания. | |
88 </listitem> | |
89 | |
90 </list> | |
91 </para> | |
92 | |
93 <para> | |
94 Пример описания: | |
95 <example> | |
96 geo $country { | |
97 default ZZ; | |
98 include conf/geo.conf; | |
99 delete 127.0.0.0/16; | |
100 proxy 192.168.100.0/24; | |
101 | |
102 127.0.0.0/24 US; | |
103 127.0.0.1/32 RU; | |
104 10.1.0.0/16 RU; | |
105 192.168.1.0/24 UK; | |
106 } | |
107 </example> | |
108 </para> | |
109 | |
110 <para> | |
111 В файле conf/geo.conf могут быть такие строки: | |
112 <example> | |
113 10.2.0.0/16 RU; | |
114 192.168.2.0/24 RU; | |
115 </example> | |
116 </para> | |
117 | |
118 <para> | |
119 В качестве значения выбирается максимальное совпадение, например, | |
120 для адреса 127.0.0.1 будет выбрано значение "RU", а не "US". | |
121 </para> | |
122 | |
123 <para> | |
124 Пример описания диапазонов: | |
125 <example> | |
126 geo $country { | |
127 ranges; | |
128 default ZZ; | |
129 127.0.0.0-127.0.0.0 US; | |
130 127.0.0.1-127.0.0.1 RU; | |
131 127.0.0.1-127.0.0.255 US; | |
132 10.1.0.0-10.1.255.255 RU; | |
133 192.168.1.0-192.168.1.255 UK; | |
134 } | |
135 </example> | |
136 </para> | |
137 | |
138 </directive> | |
139 | |
140 </section> | |
141 | |
142 </module> |