Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_geo_module.xml @ 2559:82e6029db0c0
Updated with Netcraft June 2020 Web Server Survey stats.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 25 Jun 2020 13:12:56 +0100 |
parents | 95c3c3bbf1ce |
children |
rev | line source |
---|---|
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
3 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
4 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
6 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
523
diff
changeset
|
7 |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <module name="Module ngx_http_geo_module" |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 link="/en/docs/http/ngx_http_geo_module.html" |
589 | 12 lang="en" |
840
9dab69f2b71d
Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents:
797
diff
changeset
|
13 rev="5"> |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 <section id="summary"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 The <literal>ngx_http_geo_module</literal> module creates variables |
966 | 19 with values depending on the client IP address. |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 </section> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 <section id="example" name="Example Configuration"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 geo $geo { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 default 0; |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
31 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
32 127.0.0.1 2; |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 192.168.1.0/24 1; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 10.1.0.0/16 1; |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
35 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
36 ::1 2; |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
37 2001:0db8::/32 1; |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 </section> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 <section id="directives" name="Directives"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 <directive name="geo"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 <syntax block="yes">[<value>$address</value>] <value>$variable</value></syntax> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 <default/> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 <context>http</context> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 Describes the dependency of values of the specified variable |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 on the client IP address. |
966 | 55 By default, the address is taken from the <var>$remote_addr</var> variable, |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 but it can also be taken from another variable (0.7.27), for example: |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 geo $arg_remote_addr $geo { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 ...; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 </example> |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
62 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
63 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
64 <para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
65 <note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
66 Since variables are evaluated only when used, the mere existence |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
67 of even a large number of declared “<literal>geo</literal>” variables |
966 | 68 does not cause any extra costs for request processing. |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
69 </note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
70 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
71 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
72 <para> |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 If the value of a variable does not represent a valid IP address |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 then the “<literal>255.255.255.255</literal>” address is used. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 <para> |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
78 Addresses are specified either as prefixes in CIDR notation |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
79 (including individual addresses) or as ranges (0.7.23). |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
80 <note> |
840
9dab69f2b71d
Documented nginx 1.2.7 changes.
Ruslan Ermilov <ru@nginx.com>
parents:
797
diff
changeset
|
81 IPv6 prefixes are supported starting from versions 1.3.10 and 1.2.7. |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
82 </note> |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
83 </para> |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
84 |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
85 <para> |
518 | 86 The following special parameters are also supported: |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 <list type="tag"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 <tag-name><literal>delete</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 deletes the specified network (0.7.23). |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
92 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 <tag-name><literal>default</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 <tag-desc> |
966 | 96 a value set to the variable if the client address does not |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 match any of the specified addresses. |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
98 When addresses are specified in CIDR notation, |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
99 “<literal>0.0.0.0/0</literal>” and “<literal>::/0</literal>” |
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
100 can be used instead of <literal>default</literal>. |
788
753ed7df8910
Documented what will be the default value of "geo" if "default" isn't set.
Ruslan Ermilov <ru@nginx.com>
parents:
716
diff
changeset
|
101 When <literal>default</literal> is not specified, the default |
753ed7df8910
Documented what will be the default value of "geo" if "default" isn't set.
Ruslan Ermilov <ru@nginx.com>
parents:
716
diff
changeset
|
102 value will be an empty string. |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
105 <tag-name><literal>include</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
106 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
107 includes a file with addresses and values. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
108 There can be several inclusions. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
109 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 <tag-name><literal>proxy</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
112 <tag-desc> |
518 | 113 defines trusted addresses (0.8.7, 0.7.63). |
114 When a request comes from a trusted address, | |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
115 an address from the <header>X-Forwarded-For</header> request |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
116 header field will be used instead. |
518 | 117 In contrast to the regular addresses, trusted addresses are |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
118 checked sequentially. |
518 | 119 <note> |
797
55b633342309
Documented "geo" support of IPv6 address prefixes.
Ruslan Ermilov <ru@nginx.com>
parents:
788
diff
changeset
|
120 Trusted IPv6 addresses are supported starting from versions 1.3.0 and 1.2.1. |
518 | 121 </note> |
122 </tag-desc> | |
123 | |
124 <tag-name><literal>proxy_recursive</literal></tag-name> | |
125 <tag-desc> | |
523 | 126 enables recursive address search (1.3.0, 1.2.1). |
966 | 127 If recursive search is disabled then instead of the original client |
518 | 128 address that matches one of the trusted addresses, the last |
129 address sent in <header>X-Forwarded-For</header> will be used. | |
966 | 130 If recursive search is enabled then instead of the original client |
518 | 131 address that matches one of the trusted addresses, the last |
132 non-trusted address sent in <header>X-Forwarded-For</header> will be used. | |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
133 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
134 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
135 <tag-name><literal>ranges</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
136 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 indicates that addresses are specified as ranges (0.7.23). |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
138 This parameter should be the first. |
966 | 139 To speed up loading of a geo base, addresses should be put in ascending order. |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
140 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
141 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
142 </list> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
143 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
144 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
145 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
146 Example: |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
147 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
148 geo $country { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 default ZZ; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
150 include conf/geo.conf; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
151 delete 127.0.0.0/16; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
152 proxy 192.168.100.0/24; |
518 | 153 proxy 2001:0db8::/32; |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
154 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
155 127.0.0.0/24 US; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
156 127.0.0.1/32 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
157 10.1.0.0/16 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
158 192.168.1.0/24 UK; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
159 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
160 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
161 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
162 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
163 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
164 The <path>conf/geo.conf</path> file could contain the following lines: |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
165 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
166 10.2.0.0/16 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
167 192.168.2.0/24 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
168 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
169 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
170 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
171 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
172 A value of the most specific match is used. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
173 For example, for the 127.0.0.1 address the value “<literal>RU</literal>” |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
174 will be chosen, not “<literal>US</literal>”. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
175 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
176 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
177 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
178 Example with ranges: |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
179 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
180 geo $country { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
181 ranges; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
182 default ZZ; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
183 127.0.0.0-127.0.0.0 US; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
184 127.0.0.1-127.0.0.1 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
185 127.0.0.1-127.0.0.255 US; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
186 10.1.0.0-10.1.255.255 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
187 192.168.1.0-192.168.1.255 UK; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
188 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
189 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
190 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
191 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
192 </directive> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
193 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
194 </section> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
195 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
196 </module> |