Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_geo_module.xml @ 718:8afb4cbc63bb
Removed vestiges of separate "introduction" and "howto".
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 11 Oct 2012 08:18:46 +0000 |
parents | 81ec181c084e |
children | 753ed7df8910 |
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" |
716
81ec181c084e
Bumped revisions due to last changes in map and geo modules.
Vladimir Homutov <vl@nginx.com>
parents:
714
diff
changeset
|
13 rev="2"> |
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 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 whose values depend on the client IP address. |
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; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 127.0.0.1/32 2; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 192.168.1.0/24 1; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 10.1.0.0/16 1; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 </section> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 <section id="directives" name="Directives"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 <directive name="geo"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 <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
|
45 <default/> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 <context>http</context> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 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
|
50 on the client IP address. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 By default an address is taken from the <var>$remote_addr</var> variable |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 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
|
53 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 geo $arg_remote_addr $geo { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 ...; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 </example> |
714
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
58 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
59 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
60 <para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
61 <note> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
62 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
|
63 of even a large number of declared “<literal>geo</literal>” variables |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
64 does not incur any extra costs for request processing. |
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 </para> |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
67 |
ec33576efaa5
Added note about minimal impact of declaring multiple variables (geo, map).
Vladimir Homutov <vl@nginx.com>
parents:
589
diff
changeset
|
68 <para> |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 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
|
70 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
|
71 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 Addresses are specified as CIDR or ranges (0.7.23). |
518 | 75 The following special parameters are also supported: |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 <list type="tag"> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 <tag-name><literal>delete</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 deletes the specified network (0.7.23). |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 <tag-name><literal>default</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 a value of variable if the client address does not |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 match any of the specified addresses. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 When CIDR is used, “<literal>0.0.0.0/0</literal>” can be written |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 instead of <literal>default</literal>. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 <tag-name><literal>include</literal></tag-name> |
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 includes a file with addresses and values. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 There can be several inclusions. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 <tag-name><literal>proxy</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 <tag-desc> |
518 | 99 defines trusted addresses (0.8.7, 0.7.63). |
100 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
|
101 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
|
102 header field will be used instead. |
518 | 103 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
|
104 checked sequentially. |
518 | 105 <note> |
523 | 106 IPv6 addresses are supported starting from versions 1.3.0 and 1.2.1. |
518 | 107 </note> |
108 </tag-desc> | |
109 | |
110 <tag-name><literal>proxy_recursive</literal></tag-name> | |
111 <tag-desc> | |
523 | 112 enables recursive address search (1.3.0, 1.2.1). |
518 | 113 If recursive search is disabled then instead of an original client |
114 address that matches one of the trusted addresses, the last | |
115 address sent in <header>X-Forwarded-For</header> will be used. | |
116 If recursive search is enabled then instead an original client | |
117 address that matches one of the trusted addresses, the last | |
118 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
|
119 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
120 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
121 <tag-name><literal>ranges</literal></tag-name> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
122 <tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
123 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
|
124 This parameter should be the first. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
125 To speed up loading of a geo base, addresses should be put in increasing order. |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
126 </tag-desc> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
127 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
128 </list> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
129 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
130 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
131 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
132 Example: |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
133 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
134 geo $country { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
135 default ZZ; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
136 include conf/geo.conf; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
137 delete 127.0.0.0/16; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
138 proxy 192.168.100.0/24; |
518 | 139 proxy 2001:0db8::/32; |
369
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
140 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
141 127.0.0.0/24 US; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
142 127.0.0.1/32 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
143 10.1.0.0/16 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
144 192.168.1.0/24 UK; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
145 } |
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 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
148 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
149 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
150 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
|
151 <example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
152 10.2.0.0/16 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
153 192.168.2.0/24 RU; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
154 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
155 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
156 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
157 <para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
158 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
|
159 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
|
160 will be chosen, not “<literal>US</literal>”. |
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 Example with ranges: |
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 geo $country { |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
167 ranges; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
168 default ZZ; |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 } |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
175 </example> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
176 </para> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
177 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
178 </directive> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
179 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
180 </section> |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
181 |
68d9e5f2ea81
English translation of ngx_http_geo_module.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
182 </module> |