GeoIP
Capture information from the client IP address in variables, using the MaxMind GeoIP databases, with the GeoIP dynamic module supported by NGINX, Inc.
Note MaxMind GeoLite Legacy databases are currently discontinued, MaxMind GeoIP2 or Geolite2 databases and NGINX Plus GeoIP2 module should be used instead.
Installation Instructions
-
Install the GeoIP module.
For Amazon Linux, CentOS, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-geoip
Note: Only 6.x and 7.x versions of CentOS, Oracle Linux, and RHEL are supported.
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-geoip
For SLES:
$ zypper install nginx-plus-module-geoip
For Alpine:
$ apk add nginx-plus-module-geoip
-
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_geoip_module.so; load_module modules/ngx_stream_geoip_module.so; http { # ... }
-
Perform additional configuration as required by the module (HTTP or TCP/UDP).
-
Reload NGINX Plus to enable the module:
$ nginx -t && nginx -s reload