# HG changeset patch # User Ruslan Ermilov # Date 1327337435 0 # Node ID 5a848934a12de16decb7ceec8b68e12b2cb6f4be # Parent daae2b619815a9ffc4f785138f5d73e7068ed480 English translation of ngx_http_geoip_module, ngx_http_map_module, ngx_http_realip_module, ngx_http_secure_link_module, ngx_http_split_clients_module, and ngx_http_sub_module. diff -r daae2b619815 -r 5a848934a12d xml/en/GNUmakefile --- a/xml/en/GNUmakefile Mon Jan 23 16:46:36 2012 +0000 +++ b/xml/en/GNUmakefile Mon Jan 23 16:50:35 2012 +0000 @@ -52,6 +52,7 @@ http/ngx_http_empty_gif_module \ http/ngx_http_fastcgi_module \ http/ngx_http_flv_module \ + http/ngx_http_geoip_module \ http/ngx_http_gzip_module \ http/ngx_http_gzip_static_module \ http/ngx_http_image_filter_module \ @@ -59,9 +60,14 @@ http/ngx_http_limit_conn_module \ http/ngx_http_limit_req_module \ http/ngx_http_log_module \ + http/ngx_http_map_module \ http/ngx_http_mp4_module \ http/ngx_http_proxy_module \ http/ngx_http_random_index_module \ + http/ngx_http_realip_module \ + http/ngx_http_secure_link_module \ + http/ngx_http_split_clients_module \ + http/ngx_http_sub_module \ http/ngx_http_upstream_module \ REFS_XML = $(foreach name, $(REFS), xml/$(DOC_LANG)/docs/$(name).xml) diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_geoip_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_geoip_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,135 @@ + + + + + + +
+ + +The ngx_http_geoip_module module (0.8.6+) creates variables +whose values depend on the client IP address, using the precompiled +MaxMind databases. + + + +This module is not built by default, it should be enabled with the +--with-http_geoip_module +configuration parameter. + +This module requires the +MaxMind GeoIP library. + + + +
+ + +
+ + + +http { + geoip_country GeoIP.dat; + geoip_city GeoLiteCity.dat; + ... + + + +
+ + +
+ + +database + +http + + +Specifies a database used to determine a country +depending on the client IP address. +The following variables are available when using this database: + + +$geoip_country_code + +two-letter country code, for example, +“RU”, “US”. + + +$geoip_country_code3 + +three-letter country code, for example, +“RUS”, “USA”. + + +$geoip_country_name + +country name, for example, +“Russian Federation”, “United States”. + + + + + + + + + +database + +http + + +Specifies a database used to determine a country, region, and city +depending on the client IP address. +The following variables are available when using this database: + + +$geoip_city_country_code + +two-letter country code, for example, +“RU”, “US”. + + +$geoip_city_country_code3 + +three-letter country code, for example, +“RUS”, “USA”. + + +$geoip_city_country_name + +country name, for example, +“Russian Federation”, “United States”. + + +$geoip_region + +country region name (region, territory, state, province, federal land +and the like), for example, +“Moscow City”, “DC”. + + +$geoip_city + +city name, for example, +“Moscow”, “Washington”. + + +$geoip_postal_code + +postal code. + + + + + + + +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_map_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_map_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,123 @@ + + + + + + +
+ + +The ngx_http_map_module module creates variables +whose values depend on values of other variables. + + +
+ + +
+ + + +map $http_host $name { + hostnames; + + default 0; + + example.com 1; + *.example.com 1; + test.com 2; + *.test.com 2; + .site.com 3; + wap.* 4; +} + + + +
+ + +
+ + + + $variable1 + $variable2 + +http + + +Creates a variable whose value +depends on the value of another variable. +The directive supports three special parameters: + +default value + +sets a value for the second variable when the value +of the first variable cannot be found. + + +hostnames + +allows to specify hostnames with a prefix or suffix mask, as source +values, for example, + +*.example.com 1; +example.* 1; + +The following two records + +example.com 1; +*.example.com 1; + +can be combined: + +.example.com 1; + + + +include file + +includes a file with values. +There can be several inclusions. + + + + + + + + + +size +32|64|128 +http + + +Sets the bucket size for the variables hash tables. +Default value depends on the size of the processor's cache line. +For more information, please refer to +Setting Up Hashes. + + + + + + +size +2048 +http + + +Sets the maximum size of the variables +hash tables. +For more information, please refer to +Setting Up Hashes. + + + + +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_realip_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_realip_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,77 @@ + + + + + + +
+ + +The ngx_http_realip_module module allows +to change the client address to the one sent in the specified header field. + + + +This module is not built by default, it should be enabled with the +--with-http_realip_module +configuration parameter. + + +
+ + +
+ + + + set_real_ip_from 192.168.1.0/24; + set_real_ip_from 192.168.2.1; + real_ip_header X-Real-IP; + + + +
+ + +
+ + +address | CIDR + +http +server +location + + +Describes trusted addresses that are known to send correct +replacement addresses. + + + + + + + + field | + X-Real-IP | + X-Forwarded-For +X-Real-IP +http +server +location + + +Defines a request header field used to send +the address for a replacement. +In case of the
X-Forwarded-For
field, +the last address in the field’s value is used. +For other fields the whole value is used. +
+ +
+ +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_secure_link_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_secure_link_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,86 @@ + + + + + + +
+ + +The ngx_http_secure_link_module module (0.7.18+) checks +the validity of the requested link. + + + +This module is not built by default, it should be enabled with the +--with-http_secure_link_module +configuration parameter. + + +
+ + +
+ + + +location /p/ { + secure_link_secret some_secret_word; + + if ($secure_link = "") { + return 403; + } +} + + + +
+ + +
+ + +word + +location + + +Defines a secret word used to check the validity of the link. +The full URL of the protected link looks as follows: + +/prefix/hash/link + +where hash is computed as + +md5(link, secret_word); + + + + +A prefix is an arbitrary string not including a slash. + + + + +
+ + +
+ + + + +$secure_link + +equals to the link extracted from the full URL. +If hash is incorrect, this variable is set to an empty string. + + + + + +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_split_clients_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_split_clients_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,70 @@ + + + + + + +
+ + +The ngx_http_split_clients_module module creates +variables suitable for A/B testing, also known as split testing. + + +
+ + +
+ + + +http { + split_clients "${remote_addr}AAA" $variant { + 0.5% .one; + 2.0% .two; + * ""; + } + + server { + location / { + index index${variant}.html; + + +
+ + +
+ + + + string + $variable + +http + + +Creates a variable for A/B testing, for example: + +split_clients "${remote_addr}AAA" $variant { + 0.5% .one; + 2.0% .two; + * ""; +} + +The value of the original string is hashed using MurmurHash2. +In the example given, hash values from 0 to 21474836 (0.5%) +correspond to the $variant variable taking the +value ".one", +hash values from 21474837 to 107374182 (2%) correspond to +the value ".two", +and hash values from 107374183 to 4294967297 correspond to +the value "". + + + + +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/http/ngx_http_sub_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_sub_module.xml Mon Jan 23 16:50:35 2012 +0000 @@ -0,0 +1,89 @@ + + + + + + +
+ + +The ngx_http_sub_module module is a filter +that modifies a response by replacing one specified string by another. + + + +This module is not built by default, it should be enabled with the +--with-http_sub_module +configuration parameter. + + +
+ + +
+ + + +location / { + sub_filter </head> + '</head><script language="javascript" src="$script"></script>'; + sub_filter_once on; +} + + + +
+ + +
+ + +string replacement + +http +server +location + + +Sets a string that needs to be changed, and a replacement string. +The string to be replaced is matched ignoring the case. +A replacement string can contain variables. + + + + + + +on | off +on +http +server +location + + +Determines how many times to look for a string to be replaced, +once or several times. + + + + + + +mime-type ... +text/html +http +server +location + + +Enables string replacement in responses with the specified MIME types +in addition to “text/html”. + + + + +
+ +
diff -r daae2b619815 -r 5a848934a12d xml/en/docs/index.xml --- a/xml/en/docs/index.xml Mon Jan 23 16:46:36 2012 +0000 +++ b/xml/en/docs/index.xml Mon Jan 23 16:50:35 2012 +0000 @@ -110,6 +110,11 @@ + +ngx_http_geoip_module + + + ngx_http_gzip_module @@ -145,6 +150,11 @@ + +ngx_http_map_module + + + ngx_http_mp4_module @@ -160,6 +170,26 @@ + +ngx_http_realip_module + + + + +ngx_http_secure_link_module + + + + +ngx_http_split_clients_module + + + + +ngx_http_sub_module + + + ngx_http_upstream_module