Syntax: Geo [$IP _variable] $variable {...} Default value: None Working with Fields: HTTP This directive specifies the country to which the client IP belongs, and by default it looks for the $remote_addr variable, but it can be specified manually after version 0.7.27.
Geo $arg _remote_addr $geo {...;}
Using CIDR address format, in addition, there are 4 special parameters:
Delete-Deletes the specified network (0.7.23) Default-replaces some undefined addresses with 0.0.0.0/0. Include-a text file with address information that can contain multiple. Proxy-Specifies the proxy server address (0.8.7). Ranges-Specifies that the address (0.7.23) be defined using the form of an address pool, which must be placed first. Geo $country {default no; include conf/geo.conf; 127.0.0.0/24 us; 127.0.0.1/32 ru; 10.1.0.0/16 ru; 192.168.1.0/24 UK;}
conf/geo.conf File Contents:
10.2.0.0/16 Ru; 192.168.2.0/24 Ru;
The value will use the largest parameter, for example, 127.0.0.1 will be "ru" instead of "us". An example of using ranges:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.