Mercurial > hg > nginx-site
diff 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 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/xml/ru/docs/http/ngx_http_geo_module.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> + +<module name="Директивы модуля ngx_http_geo_module" + link="/ru/docs/http/ngx_http_geo_module.html" + lang="ru"> + +<section name="" id="summary"> + +<para> +Модуль ngx_http_geo_module создаёт переменные, значения которых +зависят от IP-адреса клиента. +</para> + +</section> + + +<section name="Пример конфигурации" id="example"> + +<para> +<example> + geo $geo { + default 0; + 127.0.0.1/32 2; + 192.168.1.0/24 1; + 10.1.0.0/16 1; + } +</example> +</para> + +</section> + + +<section name="Директивы" id="directives"> + +<directive name="geo"> +<syntax>geo <value>[$адрес] $переменная { ... }</value> +</syntax> +<default>нет</default> +<context>http</context> + +<para> +Директива geo описывает для указанной переменной зависимость значения от +IP-адреса клиента. +По умолчанию адрес берётся из переменной $remote_addr, но его также (0.7.27) +можно получить из другой переменной, например: +<example> + geo $arg_remote_addr $geo { + ...; + } +</example> +Если значение переменной не представляет из себя правильный IP-адрес, +то используется адрес "255.255.255.255". +</para> +<para> +Адреса задаются в виде CIDR или в виде диапазонов (0.7.23). +Кроме того, есть четыре специальных параметра: +<list type="bullet"> + +<listitem> +delete — удаляет описанную сеть (0.7.23). +</listitem> + +<listitem> +default — значение переменной, если адрес клиента не соответствует +ни одному заданному адресу. +При использовании CIDR вместо default можно также написать 0.0.0.0/0. +</listitem> + +<listitem> +include — включает файл с адресами и значениями. +Включений может быть несколько. +</listitem> + +<listitem> +proxy — задаёт адреса проски-серверов (0.8.7, 0.7.63), +при запросе с которых будет использоваться адрес в переданной +в строке заголовка запроса "X-Forwarded-For". +В отличие от обычных адресов, адреса прокси-серверов проверяются +последовательно. +</listitem> + +<listitem> +ranges — указывает, что адреса задаются в виде диапазонов (0.7.23). +Эта директива должны быть первой. +Для ускорения загрузки гео-базы нужно располагать адреса в порядке возрастания. +</listitem> + +</list> +</para> + +<para> +Пример описания: +<example> + geo $country { + default ZZ; + include conf/geo.conf; + delete 127.0.0.0/16; + proxy 192.168.100.0/24; + + 127.0.0.0/24 US; + 127.0.0.1/32 RU; + 10.1.0.0/16 RU; + 192.168.1.0/24 UK; + } +</example> +</para> + +<para> +В файле conf/geo.conf могут быть такие строки: +<example> +10.2.0.0/16 RU; +192.168.2.0/24 RU; +</example> +</para> + +<para> +В качестве значения выбирается максимальное совпадение, например, +для адреса 127.0.0.1 будет выбрано значение "RU", а не "US". +</para> + +<para> +Пример описания диапазонов: +<example> + geo $country { + ranges; + default ZZ; + 127.0.0.0-127.0.0.0 US; + 127.0.0.1-127.0.0.1 RU; + 127.0.0.1-127.0.0.255 US; + 10.1.0.0-10.1.255.255 RU; + 192.168.1.0-192.168.1.255 UK; + } +</example> +</para> + +</directive> + +</section> + +</module>