The ngx_stream_geoip_module
module (1.11.3) creates variables with values depending on the client IP address, using the precompiled MaxMind databases.
When using the databases with IPv6 support, IPv4 addresses are looked up as IPv4-mapped IPv6 addresses.
This module is not built by default, it should be enabled with the --with-stream_geoip_module
configuration parameter.
This module requires the MaxMind GeoIP library.
stream { geoip_country GeoIP.dat; geoip_city GeoLiteCity.dat; map $geoip_city_continent_code $nearest_server { default example.com; EU eu.example.com; NA na.example.com; AS as.example.com; } ... }
Syntax: | geoip_country |
---|---|
Default: | — |
Context: | stream |
Specifies a database used to determine the country depending on the client IP address. The following variables are available when using this database:
$geoip_country_code
RU
”, “US
”. $geoip_country_code3
RUS
”, “USA
”. $geoip_country_name
Russian Federation
”, “United States
”. Syntax: | geoip_city |
---|---|
Default: | — |
Context: | stream |
Specifies a database used to determine the country, region, and city depending on the client IP address. The following variables are available when using this database:
$geoip_area_code
This variable may contain outdated information since the corresponding database field is deprecated.
$geoip_city_continent_code
EU
”, “NA
”. $geoip_city_country_code
RU
”, “US
”. $geoip_city_country_code3
RUS
”, “USA
”. $geoip_city_country_name
Russian Federation
”, “United States
”. $geoip_dma_code
$geoip_latitude
$geoip_longitude
$geoip_region
48
”, “DC
”. $geoip_region_name
Moscow City
”, “District of Columbia
”. $geoip_city
Moscow
”, “Washington
”. $geoip_postal_code
Syntax: | geoip_org |
---|---|
Default: | — |
Context: | stream |
Specifies a database used to determine the organization depending on the client IP address. The following variable is available when using this database:
$geoip_org
© 2002-2017 Igor Sysoev
© 2011-2017 Nginx, Inc.
Licensed under the BSD License.
https://nginx.org/en/docs/stream/ngx_stream_geoip_module.html