- install
awstats package
- create the file
/etc/awstats/awstats.conf.local with global options:
LogType=W
LogFormat = 1
DNSLookup=1
DirData="/var/lib/awstats"
SkipHosts="123.45.67.89"
- create a specific file for each virtual host e.g.
/etc/awstats/awstats.mysite.conf:
LogFile="/var/log/apache2/mysite-access.log"
SiteDomain="mysite.com"
Include "/etc/awstats/awstats.conf.local"
- create
/etc/cron.daily/awstats and include two lines for each virtual host:
#!/bin/sh
/usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=mysite -update > /dev/null
/usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=mysite -output -staticlinks > /var/www/abc123/awstats.mysite.html
- create the output directory:
mkdir /var/www/abc123
- create a virtual host for the stats
<VirtualHost *:80>
ServerAdmin webmaster@mysite.com
ServerName mysite.com
DirectoryIndex list.html
DocumentRoot /var/www/def456
Alias /icon "/usr/share/awstats/icon/"
<Directory /var/www/def456>
AuthType Basic
AuthName "Web stats"
AuthUserFile /etc/apache2/stats.passwd
Require valid-user
</Directory>
</VirtualHost>
- You may also want to password protect the directory (see apache notes).