February 2018
Beginner to intermediate
348 pages
9h 40m
English
The purpose of this module is to provide functionality that is quite similar to the map directive, affecting a variable based on client data (in this case, the IP address). The syntax is slightly different, in the extent that you are allowed to specify IPv4 and IPv6 address ranges (in CIDR format):
geo $variable {
default unknown;
127.0.0.1 local;
123.12.3.0/24 uk;
92.43.0.0/16 fr;
}
Note that the preceding block is being presented to you just for the sake of the example and does not actually detect UK and French visitors; you'll want to use the GeoIP module if you wish to achieve proper geographical location detection. In this block, you may insert a number of directives that are specific to this module: