mod_maxmind configuration

Started by Gregg, April 04, 2018, 08:48:24 PM

Previous topic - Next topic

Gregg

We give ONLY enough info in the readme file to get started with using Maxmind's Country database. I personally like to see the cities as well, not that the free City DB is very accurate I still get an idea of where in the country a user is from. Why do I like this you ask? I see it as free geography lessons :)

Maxmind has 3 free databases available, Country, City and ASN (autonomous system number). They can be obtained from Maxmind. These days you must obtain an account to download the databases. You can downloaded the GeoLite2 databases for free. They are updated at least monthly.

I decided to add the ASN data for the fun of it and ran into the same exact problem I ran up against with the City DB a few years ago, there is little to no information on how to use these databases. I figured it out by looking at what little examples I could find and inside the DBs themselves.

If you download any one of the CVS databases the layout is specified on the first line. But since I have already done this work, and looking at what little info we include in the readme, I figure I'll just post all the possible configurations for the various databases available.

Country Database

There are only the two possibilities already included in the readme that comes with the module.

City Database

MaxMindDBEnv MM_CITY_NAME_EN CITY_DB/city/names/en
MaxMindDBEnv MM_CITY_NAME_DE CITY_DB/city/names/de
MaxMindDBEnv MM_CITY_NAME_ES CITY_DB/city/names/es
MaxMindDBEnv MM_CITY_NAME_FR CITY_DB/city/names/fr
MaxMindDBEnv MM_CITY_NAME_PT_BR CITY_DB/city/names/pt-BR
MaxMindDBEnv MM_CONTINENT_CODE CITY_DB/continent/code
MaxMindDBEnv MM_CONTINENT_GEONAME_ID CITY_DB/continent/geoname_id
MaxMindDBEnv MM_CONTINENT_NAME_EN CITY_DB/continent/names/en
MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code
MaxMindDBEnv MM_COUNTRY_GEONAME_ID CITY_DB/country/geoname_id
MaxMindDBEnv MM_COUNTRY_NAME CITY_DB/country/names/en
MaxMindDBEnv MM_COUNTRY_NAME_DE CITY_DB/country/names/de
MaxMindDBEnv MM_COUNTRY_NAME_EN CITY_DB/country/names/en
MaxMindDBEnv MM_COUNTRY_NAME_ES CITY_DB/country/names/es
MaxMindDBEnv MM_COUNTRY_NAME_FR CITY_DB/country/names/fr
MaxMindDBEnv MM_COUNTRY_NAME_JA CITY_DB/country/names/ja
MaxMindDBEnv MM_COUNTRY_NAME_PT_BR CITY_DB/country/names/pt-BR
MaxMindDBEnv MM_COUNTRY_NAME_RU CITY_DB/country/names/ru
MaxMindDBEnv MM_COUNTRY_NAME_ZH_CN CITY_DB/country/names/zh-CN
MaxMindDBEnv MM_LOCATION_LATITUDE CITY_DB/location/latitude
MaxMindDBEnv MM_LOCATION_LONGITUDE CITY_DB/location/longitude
MaxMindDBEnv MM_LOCATION_TIME_ZONE CITY_DB/location/time_zone
MaxMindDBEnv MM_POSTAL_CODE CITY_DB/postal/code
MaxMindDBEnv MM_REGISTERED_COUNTRY_ISO_CODE CITY_DB/registered_country/iso_code
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_DE CITY_DB/registered_country/names/de
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_EN CITY_DB/registered_country/names/en
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_ES CITY_DB/registered_country/names/es
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_FR CITY_DB/registered_country/names/fr
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_JA CITY_DB/registered_country/names/ja
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_PT_BR CITY_DB/registered_country/names/pt_br
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_RU CITY_DB/registered_country/names/ru
MaxMindDBEnv MM_REGISTERED_COUNTRY_NAMES_ZH_CN CITY_DB/registered_country/names/zh-CN
MaxMindDBEnv MM_REGION_GEONAME_ID CITY_DB/subdivisions/0/geoname_id
MaxMindDBEnv MM_REGION_ISO_CODE CITY_DB/subdivisions/0/iso_code
MaxMindDBEnv MM_REGION_NAMES_DE CITY_DB/subdivisions/0/names/de
MaxMindDBEnv MM_REGION_NAMES_EN CITY_DB/subdivisions/0/names/en
MaxMindDBEnv MM_REGION_NAMES_ES CITY_DB/subdivisions/0/names/es
MaxMindDBEnv MM_REGION_NAMES_FR CITY_DB/subdivisions/0/names/fr
MaxMindDBEnv MM_REGION_NAMES_JA CITY_DB/subdivisions/0/names/ja
MaxMindDBEnv MM_REGION_NAMES_PT_BR CITY_DB/subdivisions/0/names/pt_br
MaxMindDBEnv MM_REGION_NAMES_RU CITY_DB/subdivisions/0/names/ru
MaxMindDBEnv MM_REGION_NAMES_ZH_CN CITY_DB/subdivisions/0/names/zh-CN

ASN Database

MaxMindDBEnv MM_ASN ASN_DB/autonomous_system_number
MaxMindDBEnv MM_ASORG ASN_DB/autonomous_system_organization


They have non-free databases and if you chose to use them you can use this information and CVS versions of the database to figure out how in the heck to get the info out. Of course I'm sure if your paying they should tell you what you need.

Edit 2020/03/30: Updated some old info, added link to DBs.