GeoIP2
Capture information from the client IP address in variables, using the MaxMind GeoIP2 databases, with the GeoIP2 dynamic module supported by NGINX, Inc.
Module Info
MaxMind GeoIP2 databases provide contextual data for a comprehensive profile of IP addresses, including geolocation data (region, state, city, postal code) and extra data (ISP, domain, connection type). Basing on these data, NGINX Plus will be able to perform different user differentiation strategies, for example, provide different type of content depending on a country.
Installation Instructions
-
Install the GeoIP2 module.
For Amazon Linux, CentOS, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-geoip2
Note: the GeoIP2 module cannot be installed on ppc64le version of CentOS, Oracle Linux, and RHEL.
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-geoip2
For Alpine:
$ apk add nginx-plus-module-geoip2
-
Put both of the
load_module
directives in the top‑level (“main
”) context of NGINX Plus configuration file, nginx.conf:load_module modules/ngx_http_geoip2_module.so; load_module modules/ngx_stream_geoip2_module.so; http { # ... }
-
Perform additional configuration as required by the module.
-
Reload NGINX Plus to enable the module:
$ nginx -t && nginx -s reload