Of course the first thing to do is installing awstats:
yum install awstats
After that, I create a symlink from awstats.pl to my cgi-bin.
ln -s /usr/share/awstats/wwwroot/cgi-bin/awstats.pl \
/var/www/vhost/domain/subdomain/cgi-bin/
Then I make sure that Apache allows symlinks:
<directory "/var/www/vhost/domain/subdomain/cgi-bin">
Options FollowSymLinks
</directory>
Furthermore we need to add a few aliases
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
Now let’s configure awstats. Awstats configuration files are in /etc/awstats. Create a new configuration file (awstats.subdomain.domain.conf) and pay attention for these parameters:
LogFile="/var/www/vhost/domain/subdomain/log/access.log"
SiteDomain="subdomain.domain"
HostAliases="subdomain.domain"
Now we can run awstats by invoking:
perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl \
-config=subdomain.domain -update
Awstats will now analyze our logfile. You should see something like:
Create/Update database for config "/etc/awstats/awstats.subdomain.domain.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/var/www/vhost/domain/subdomain/access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 117)
Jumped lines in file: 117
Found 117 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.
You should have a working awstats now. Access http://subdomain.domain/cgi-bin/awstats.pl?config=subdomain.domain to verify this.
Finaly, we can make our life a little bit easier by using a tool called AWStats Totals. This tool will (automatically) summarize for which domains we have generated statistics and make those available to us.
Installing AWStats Totals is really easy. The only thing you have to do is download it
cd /var/www/vhost/domain/subdomain/public_html
wget http://www.telartis.nl/files/awstatstotals.zip
unzip it
unzip awstatstotals.zip
put it in place
mv awstatstotals/awstatstotals.php .
rm -R awstatstotals __MACOSX
What I do next is symlink it
ln -s awstatstotals.php index.php
Now, we should see a nice summary when we access http://subdomain.domain/index.php.