awstats and country detection

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
The default awstats "geoipfree" plugin does a really bad job and detecting countries, it produces horrible results.

Are there any step-by-step instructions on how to replace this with something that actually works and gives correct country information? (something that doesn't require subscription)

Thank you.
 

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
Here is how to make AWSTATS produce proper Country and City statistics:

1) download the following two files:
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

2) gunzip them under /usr/local/lib/ (easily accessible from cPanel and awstats)

3) Make sure you have the perl module "Geo::IP::PurePerl" installed. Go to WHM->Install a Perl Script and install it if you don't.

4) Edit /usr/local/cpanel/etc/awstats.conf and at the bottom REMOVE the geoipfree plugin and add the following:

Code:
#LoadPlugin="geoipfree" (disabled, so we can use geoip with database)
LoadPlugin="geoip GEOIP_STANDARD /usr/local/lib/GeoIP.dat"

# You need the "geoip_city_maxmind" which is not included by default in cPanel
#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/lib/GeoLiteCity.dat"
Finally, proper statistics!!!
 
Last edited:

Voltar

Well-Known Member
Apr 30, 2007
267
1
168
Bakersfield, California
Here is how to make AWSTATS produce proper Country and City statistics:

1) download the following two files:
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

2) gunzip them under /usr/local/lib/ (easily accessible from cPanel and awstats)

3) Make sure you have the perl module "Geo::IP::PurePerl" installed. Go to WHM->Install a Perl Script and install it if you don't.

4) Edit /usr/local/cpanel/etc/awstats.conf and at the bottom REMOVE the geoipfree plugin and add the following:

Code:
#LoadPlugin="geoipfree" (disabled, so we can use geoip with database)
LoadPlugin="geoip GEOIP_STANDARD /usr/local/lib/GeoIP.dat"

# You need the "geoip_city_maxmind" which is not included by default in cPanel
#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/lib/GeoLiteCity.dat"
Finally, proper statistics!!!
Nice info. I've never had anyone complain about stats, but I'll do this just to get an improvement. Question, is it worth installing the "geoip_city_maxmind" (guessing it needs to be installed manually since it's commented out above?) ?
 

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
You won't get complaints if your users are US-based, because the default geoipfree just dumps everyone it doesn't understand as a US connection. Everyone else will complain that their users are 90% from Spain, while awstats reports that they come from the US.

Can't say if its worth it, maybe for US-based websites since thats the most detailed information that the database has at the moment.