SITE MANAGEMENT - STATISTICS

Apache 2 Statistics using AWSTATS with GeoIP integration

  • Aim: provide basic access protection via password authentication and IP restrictions
  • Environment tested: CentOS 5.4, Apache 2

Under construction. I will have to revise the document with CentOS 5.4 in mind.

ENABLING IP RESTRICTIONS FOR AWSTATS



Restricting access to your stats via IP address is actually pretty simple to configure. In CentOS 5.4, AWSTATS ( version used: awstats-6.95-1.el5.rf ) stores its configuration in:

/etc/httpd/conf.d/awstats.conf

To restrict access to the stats by IP, you need to make sure that the directory rights are set to deny by default, and only allow the addresses and subnets you will permit implicitely, Here is the sample config:

Alias /awstats/icon/ /var/www/awstats/icon/

ScriptAlias /awstats/ /var/www/awstats/

DirectoryIndex awstats.pl
Options ExecCGI
order deny,allow
deny from all
allow from 127.0.0.1 192.168.1.0/24 111.111.111.111/32



In the example above, localhost access is allowed, the internal network and a single external host are set as the only sources allowed. If you have a fixed IP at work, it’s an easy way to check your stats on a regular basis.