Debian, AWStats, Apache 2 and Virtual Hosts
The usual HowTos and documentation on sites like www.debian-administration.org, www.debianhelp.co.uk or wiki.debian.org describe, how to configure AWStats on Debian GNU/Linux for a host with a single domain, but not a host with multiple virtual domains, like one of the machines I am supporting.
Thankfully, Sami Dalouche has a wonderfully detailed HowTo on his blog. This article describes Apache setup, AWStats configuration, all the necessary Cron-jobs to regulary get the data into the AWStats database and even recommended ACL settings for the logfiles, etc.
And if you want to password protect your statistics, here is a short recipie:
Create a username/password file like this:
htpasswd -c /etc/awstats/awstats.htpasswd username
Now, edit /etc/apache2/sites-enabled/000-default or the site-document you want to protect, and under <Directory „/usr/lib/cgi-bin”>, add
AuthType basic AuthName "cgi-bin restricted" AuthUserFile /etc/awstats/awstats.htpasswd <Files awstats.pl> Require valid-user </Files>
Reload Apache and you are done.