# HG changeset patch # User Ruslan Ermilov # Date 1327703341 0 # Node ID 68d9e5f2ea81da0e3c98be3412c62f8de6d56275 # Parent ce12542164cfb7383986cf6d01b14bcdc9585049 English translation of ngx_http_geo_module. diff --git a/xml/en/GNUmakefile b/xml/en/GNUmakefile --- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -53,6 +53,7 @@ REFS = \ http/ngx_http_empty_gif_module \ http/ngx_http_fastcgi_module \ http/ngx_http_flv_module \ + http/ngx_http_geo_module \ http/ngx_http_geoip_module \ http/ngx_http_gzip_module \ http/ngx_http_gzip_static_module \ diff --git a/xml/en/docs/http/ngx_http_geo_module.xml b/xml/en/docs/http/ngx_http_geo_module.xml new file mode 100644 --- /dev/null +++ b/xml/en/docs/http/ngx_http_geo_module.xml @@ -0,0 +1,150 @@ + + + + + + +
+ + +The ngx_http_geo_module module creates variables +whose values depend on the client IP address. + + +
+ + +
+ + + +geo $geo { + default 0; + 127.0.0.1/32 2; + 192.168.1.0/24 1; + 10.1.0.0/16 1; +} + + + +
+ + +
+ + +[$address] $variable + +http + + +Describes the dependency of values of the specified variable +on the client IP address. +By default an address is taken from the $remote_addr variable +but it can also be taken from another variable (0.7.27), for example: + +geo $arg_remote_addr $geo { + ...; +} + +If the value of a variable does not represent a valid IP address +then the “255.255.255.255” address is used. + + + +Addresses are specified as CIDR or ranges (0.7.23). +There are also five special parameters: + + +delete + +deletes the specified network (0.7.23). + + +default + +a value of variable if the client address does not +match any of the specified addresses. +When CIDR is used, “0.0.0.0/0” can be written +instead of default. + + +include + +includes a file with addresses and values. +There can be several inclusions. + + +proxy + +sets the addresses of proxy servers (0.8.7, 0.7.63). +When a request comes from one of the proxy servers, +an address from the
X-Forwarded-For
request +header field will be used instead. +In contrast to the regular addresses, proxy server addresses are +checked sequentially. +
+ +ranges + +indicates that addresses are specified as ranges (0.7.23). +This parameter should be the first. +To speed up loading of a geo base, addresses should be put in increasing order. + + +
+
+ + +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; +} + + + + +The conf/geo.conf file could contain the following lines: + +10.2.0.0/16 RU; +192.168.2.0/24 RU; + + + + +A value of the most specific match is used. +For example, for the 127.0.0.1 address the value “RU” +will be chosen, not “US”. + + + +Example with ranges: + +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; +} + + + +
+ +
+ +
diff --git a/xml/en/docs/index.xml b/xml/en/docs/index.xml --- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -115,6 +115,11 @@ ngx_http_flv_module + +ngx_http_geo_module + + + ngx_http_geoip_module diff --git a/xml/en/index.xml b/xml/en/index.xml --- a/xml/en/index.xml +++ b/xml/en/index.xml @@ -129,7 +129,8 @@ The rewrite module: URI changing using r -Executing different functions depending on the client address; +Executing different functions depending on the +client address;