Project

General

Profile

Mod maxminddb » History » Revision 2

Revision 1 (gstrauss, 2019-05-27 20:33) → Revision 2/4 (gstrauss, 2019-05-27 20:34)

h1. IP Based Geographic Lookups 

 {{>toc}} 

 Module: mod_maxminddb 

 h2. Requirements 

 Packages: GeoIP2 C API & Library libmaxminddb 

 https://github.com/maxmind/libmaxminddb 
 https://dev.maxmind.com/geoip/ 
 https://dev.maxmind.com/geoip/geoip2/geolite2/ 

 h2. Overview 

 mod_maxminddb is a module for fast ip/location lookups, available since lighttpd 1.4.54. lookups. It uses MaxMind GeoIP2 databases.    If the IP was found in the database, the module sets the appropriate environment variables to the request, thus making this information available to other modules/fcgi. 

 https://dev.maxmind.com/geoip/geoip2/geolite2/#Downloads 

 mod_maxminddb consumes MaxMind GeoIP2 databases.    This is the successor to GeoIP Legacy databases.    GeoIP Legacy databases were discontinued 2 Jan 2019 (https://dev.maxmind.com/geoip/legacy/release-notes/) and [[Docs_ModGeoIP|mod_geoip]] is now deprecated. 


 h2. Configuration Options 

   maxminddb.activate = "enable"    (default: "disable") 

   maxminddb.db = "/path/to/the/GeoIP2/database.mmdb" 

   maxminddb.env = (...) - list of environment variables to set and associated lookup keys in GeoIP2 .mmdb. 

      maxminddb.env = ( 
          "GEOIP_COUNTRY_CODE"     => "country/iso_code", 
          "GEOIP_COUNTRY_NAME"     => "country/names/en", 
          "GEOIP_CITY_NAME"        => "city/names/en", 
          "GEOIP_CITY_LATITUDE"    => "location/latitude", 
          "GEOIP_CITY_LONGITUDE" => "location/longitude", 
 ) 

 Redirecting based on GeoIP2 data can be performed inside lighttpd using [[Docs_ModMagnet|mod_magnet]] or using backend CGI, FastCGI, SCGI, etc.