The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

awstats and country detection

Discussion in 'General Discussion' started by sehh, Jan 27, 2009.

  1. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    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.
     
  2. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    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!!!
     
    #2 sehh, Feb 1, 2009
    Last edited: Feb 1, 2009
  3. Voltar

    Voltar Well-Known Member

    Joined:
    Apr 30, 2007
    Messages:
    269
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Bakersfield, California
    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?) ?
     
  4. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    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.
     
Loading...

Share This Page