No description
Find a file
2014-03-19 14:32:04 -07:00
config Initial commit 2014-01-30 23:00:34 +00:00
LICENSE Initial commit 2014-01-30 23:00:34 +00:00
ngx_http_geoip2_module.c Remove printf line 2014-03-19 14:32:04 -07:00
README.md Support setting default variable value 2014-03-19 12:58:41 -07:00

Description

ngx_http_geoip2_module - creates variables with values from the maxmind geoip2 databases based on the client IP (supports both IPv4 and IPv6)

Installing

First install libmaxminddb as described in its README.md file.

Compile nginx:

./configure --add-module=/path/to/ngx_http_geoip2_module
make 
make install

Download Maxmind GeoLite2 Database (optional)

The free GeoLite2 databases are available from Maxminds website

GeoLite2 City GeoLite2 Country

Example Usage:

http {
    ...
    geoip2_mmdb        /etc/maxmind-city.mmdb;
    geoip2_data        $geoip2_data_country_code country iso_code;
    geoip2_data        $geoip2_data_country_name country names en;
    geoip2_data        $geoip2_data_city_name city names en;
    geoip2_data        $geoip2_data_geoname_id country geoname_id;
    geoip2_data        $geoip2_data_latitude location latitude;
    geoip2_data        $geoip2_data_country_code default=US country iso_code;
    ....
}