Tag Archives: Geoip

Configure awstats:
Instead of using the awstats configure tool (written in Perl), manually add in the awstats Apache configuration. Using the tutorial from debuntu, make a file inside your apache config folder called awstats.conf with the following lines.

Inside the Apache2.conf file (or virtual host conf file inside the sites-available folder) add this to the end of the file:

Include /etc/apache2/awstats.conf

Next, copy the /usr/lib/cgi-bin/awstats.pl file to the apache cgi-bin folder. If you have virtual hosts enabled, copy it to the cgi-bin located in the designated virtual hosts folder.

Configure the awstats.conf sample file located in /etc/awstats/awstats.conf
1) Set the LogFile to the server’s logfile directory (usually /var/log/apache2/access.log)
2) Set LogFormat to 1.
3) Set DNSLookup=0 (No DNS Lookup is necessary when you use GeoIP DB, instructions are below)
4) Uncomment this line (remove the # from the beginning)
LoadPlugin=”geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat”

Install GeoIP to speed up the hostname lookups. This will significanly improve the performance since DNS lookups will generally take a long time. Using this tutorial, install the GeoIP library:

Next, download the latest GeoIP perl module -and- latest GeoLite country database.http://www.maxmind.com/download/geoip/api/perl/ I usually run wget to download the file from shell. wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.36.tar.gz

Extract the tar file and inside the Geo-IP folder, run:

perl Makefile.PL
make
make test
make install

GeoIP should now be installed. You can now generate the reports:
/usr/lib/cgi-bin/awstats.pl -config=[NAME OF YOUR INSTALL] -update
For instance, if you called the install “sample”, you should have a file called /etc/awstats/awstats.sample.conf The command for sample would be:
/usr/lib/cgi-bin/awstats.pl -config=sample -update
To run awstats:
http://[SERVER]/cgi-bin/awstats.pl?config=[NAME OF YOUR INSTALL]