Mercurial > hg > nginx-site
changeset 1750:0e591e97737c
Documented the geoip module in stream.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 13 Jul 2016 21:15:55 +0300 |
parents | 153a99d25210 |
children | 3768eb3d9c6c |
files | xml/en/GNUmakefile xml/en/docs/index.xml xml/en/docs/stream/ngx_stream_geoip_module.xml xml/ru/GNUmakefile xml/ru/docs/index.xml xml/ru/docs/stream/ngx_stream_geoip_module.xml |
diffstat | 6 files changed, 52 insertions(+), 104 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -96,6 +96,7 @@ REFS = \ mail/ngx_mail_ssl_module \ stream/ngx_stream_access_module \ stream/ngx_stream_core_module \ + stream/ngx_stream_geoip_module \ stream/ngx_stream_limit_conn_module \ stream/ngx_stream_map_module \ stream/ngx_stream_proxy_module \
--- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -8,7 +8,7 @@ <article name="nginx documentation" link="/en/docs/" lang="en" - rev="26" + rev="27" toc="no"> @@ -492,6 +492,11 @@ ngx_stream_access_module</link> </listitem> <listitem> +<link doc="stream/ngx_stream_geoip_module.xml"> +ngx_stream_geoip_module</link> +</listitem> + +<listitem> <link doc="stream/ngx_stream_limit_conn_module.xml"> ngx_stream_limit_conn_module</link> </listitem>
copy from xml/en/docs/http/ngx_http_geoip_module.xml copy to xml/en/docs/stream/ngx_stream_geoip_module.xml --- a/xml/en/docs/http/ngx_http_geoip_module.xml +++ b/xml/en/docs/stream/ngx_stream_geoip_module.xml @@ -1,33 +1,32 @@ <?xml version="1.0"?> <!-- - Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> -<module name="Module ngx_http_geoip_module" - link="/en/docs/http/ngx_http_geoip_module.html" +<module name="Module ngx_stream_geoip_module" + link="/en/docs/stream/ngx_http_geoip_module.html" lang="en" - rev="5"> + rev="1"> <section id="summary"> <para> -The <literal>ngx_http_geoip_module</literal> module (0.8.6+) creates variables +The <literal>ngx_stream_geoip_module</literal> module (1.11.3) creates variables with values depending on the client IP address, using the precompiled <link url="http://www.maxmind.com">MaxMind</link> databases. </para> <para> -When using the databases with IPv6 support (1.3.12, 1.2.7), +When using the databases with IPv6 support, IPv4 addresses are looked up as IPv4-mapped IPv6 addresses. </para> <para> This module is not built by default, it should be enabled with the -<literal>--with-http_geoip_module</literal> +<literal>--with-stream_geoip_module</literal> configuration parameter. <note> This module requires the @@ -42,13 +41,18 @@ This module requires the <para> <example> -http { +stream { geoip_country GeoIP.dat; geoip_city GeoLiteCity.dat; - geoip_proxy 192.168.100.0/24; - geoip_proxy 2001:0db8::/32; - geoip_proxy_recursive on; - ... + + map $geoip_city_continent_code $nearest_server { + default example.com; + EU eu.example.com; + NA na.example.com; + AS as.example.com; + } + ... +} </example> </para> @@ -60,7 +64,7 @@ http { <directive name="geoip_country"> <syntax><value>file</value></syntax> <default/> -<context>http</context> +<context>stream</context> <para> Specifies a database used to determine the country @@ -96,7 +100,7 @@ country name, for example, <directive name="geoip_city"> <syntax><value>file</value></syntax> <default/> -<context>http</context> +<context>stream</context> <para> Specifies a database used to determine the country, region, and city @@ -186,8 +190,7 @@ postal code. <directive name="geoip_org"> <syntax><value>file</value></syntax> <default/> -<context>http</context> -<appeared-in>1.0.3</appeared-in> +<context>stream</context> <para> Specifies a database used to determine the organization @@ -205,42 +208,6 @@ organization name, for example, “The University of Melbourne”. </directive> - -<directive name="geoip_proxy"> -<syntax><value>address</value> | <value>CIDR</value></syntax> -<default/> -<context>http</context> -<appeared-in>1.3.0</appeared-in> -<appeared-in>1.2.1</appeared-in> - -<para> -Defines trusted addresses. -When a request comes from a trusted address, -an address from the <header>X-Forwarded-For</header> request -header field will be used instead. -</para> - -</directive> - - -<directive name="geoip_proxy_recursive"> -<syntax><literal>on</literal> | <literal>off</literal></syntax> -<default>off</default> -<context>http</context> -<appeared-in>1.3.0</appeared-in> -<appeared-in>1.2.1</appeared-in> - -<para> -If recursive search is disabled then instead of the original client -address that matches one of the trusted addresses, the last -address sent in <header>X-Forwarded-For</header> will be used. -If recursive search is enabled then instead of the original client -address that matches one of the trusted addresses, the last -non-trusted address sent in <header>X-Forwarded-For</header> will be used. -</para> - -</directive> - </section> </module>
--- a/xml/ru/GNUmakefile +++ b/xml/ru/GNUmakefile @@ -85,6 +85,7 @@ REFS = \ mail/ngx_mail_ssl_module \ stream/ngx_stream_access_module \ stream/ngx_stream_core_module \ + stream/ngx_stream_geoip_module \ stream/ngx_stream_limit_conn_module \ stream/ngx_stream_map_module \ stream/ngx_stream_proxy_module \
--- a/xml/ru/docs/index.xml +++ b/xml/ru/docs/index.xml @@ -8,7 +8,7 @@ <article name="nginx: документация" link="/ru/docs/" lang="ru" - rev="26" + rev="27" toc="no"> @@ -496,6 +496,11 @@ ngx_stream_access_module</link> </listitem> <listitem> +<link doc="stream/ngx_stream_geoip_module.xml"> +ngx_stream_geoip_module</link> +</listitem> + +<listitem> <link doc="stream/ngx_stream_limit_conn_module.xml"> ngx_stream_limit_conn_module</link> </listitem>
copy from xml/ru/docs/http/ngx_http_geoip_module.xml copy to xml/ru/docs/stream/ngx_stream_geoip_module.xml --- a/xml/ru/docs/http/ngx_http_geoip_module.xml +++ b/xml/ru/docs/stream/ngx_stream_geoip_module.xml @@ -1,34 +1,33 @@ <?xml version="1.0"?> <!-- - Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> -<module name="Модуль ngx_http_geoip_module" - link="/ru/docs/http/ngx_http_geoip_module.html" +<module name="Модуль ngx_stream_geoip_module" + link="/ru/docs/http/ngx_stream_geoip_module.html" lang="ru" - rev="5"> + rev="1"> <section id="summary"> <para> -Модуль <literal>ngx_http_geoip_module</literal> (0.8.6+) создаёт переменные, +Модуль <literal>ngx_stream_geoip_module</literal> (1.11.3) создаёт переменные, значения которых зависят от IP-адреса клиента, используя готовые базы данных <link url="http://www.maxmind.com">MaxMind</link>. </para> <para> -При использовании баз данных с поддержкой IPv6 (1.3.12, 1.2.7) +При использовании баз данных с поддержкой IPv6 IPv4-адреса ищутся отображёнными на IPv6. </para> <para> По умолчанию этот модуль не собирается, его сборку необходимо разрешить с помощью конфигурационного параметра -<literal>--with-http_geoip_module</literal>. +<literal>--with-stream_geoip_module</literal>. <note> Для сборки и работы этого модуля нужна библиотека <link url="http://www.maxmind.com/app/c">MaxMind GeoIP</link>. @@ -42,13 +41,18 @@ IPv4-адреса ищутся отображёнными на IPv6. <para> <example> -http { +stream { geoip_country GeoIP.dat; geoip_city GeoLiteCity.dat; - geoip_proxy 192.168.100.0/24; - geoip_proxy 2001:0db8::/32; - geoip_proxy_recursive on; - ... + + map $geoip_city_continent_code $nearest_server { + default example.com; + EU eu.example.com; + NA na.example.com; + AS as.example.com; + } + ... +} </example> </para> @@ -60,7 +64,7 @@ http { <directive name="geoip_country"> <syntax><value>файл</value></syntax> <default/> -<context>http</context> +<context>stream</context> <para> Задаёт базу данных для определения страны в зависимости @@ -96,7 +100,7 @@ http { <directive name="geoip_city"> <syntax><value>файл</value></syntax> <default/> -<context>http</context> +<context>stream</context> <para> Задаёт базу данных для определения страны, региона и города @@ -187,8 +191,7 @@ Google AdWords API. <directive name="geoip_org"> <syntax><value>файл</value></syntax> <default/> -<context>http</context> -<appeared-in>1.0.3</appeared-in> +<context>stream</context> <para> Задаёт базу данных для определения названия организации @@ -206,40 +209,6 @@ Google AdWords API. </directive> - -<directive name="geoip_proxy"> -<syntax><value>адрес</value> | <value>CIDR</value></syntax> -<default/> -<context>http</context> -<appeared-in>1.3.0</appeared-in> -<appeared-in>1.2.1</appeared-in> - -<para> -Задаёт доверенные адреса, при запросе с которых будет использоваться -адрес в переданном поле заголовка запроса <header>X-Forwarded-For</header>. -</para> - -</directive> - - -<directive name="geoip_proxy_recursive"> -<syntax><literal>on</literal> | <literal>off</literal></syntax> -<default>off</default> -<context>http</context> -<appeared-in>1.3.0</appeared-in> -<appeared-in>1.2.1</appeared-in> - -<para> -При выключенном рекурсивном поиске вместо исходного адреса клиента, -совпадающего с одним из доверенных адресов, будет использоваться последний -адрес, переданный в <header>X-Forwarded-For</header>. -При включённом рекурсивном поиске вместо исходного адреса клиента, -совпадающего с одним из доверенных адресов, будет использоваться последний -не доверенный адрес, переданный в <header>X-Forwarded-For</header>. -</para> - -</directive> - </section> </module>