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

  1. 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
  2. Put both of the load_module directives in the top‑level (“main”) context of NGINX Plus configuration file, nginx.conf:

    load_module modules/;
    load_module modules/;
    http {
        # ...
  3. Perform additional configuration as required by the module.

  4. Reload NGINX Plus to enable the module:

    $ nginx -t && nginx -s reload

More Info