AWStats on Debian Lenny with virtual hosts

Quick setup for AWStats:

install the debian package for AWStats. Make a copy of the base config file:

cd /etc/awstats/
cp awstats.conf

edit it to your needs, especially, you need to set:


that does: * set the log file to use * set the name that is used for the site you are studying, to avoid referee stats on your own site * both last lines I added to avoid having all my accesses from the intranet on the website in the statistics.

If you use logrotate and want to start having statistics on all the last logs, you have to concatenate them all in the above named log file, ordered by time. You can use a quick script like this (if you have logs numbered and gz compressed, I had 52 files):

for i in `seq 52 -1 2`;
    zcat$i.gz >> mysite-access.log

Then, you just have to concatenate the two most recent files in log.

Then, run the statistics:


if it failed, you should clean /var/lib/awstats/ and start again.

Add a redirection to the cgi-bin directory that contains awstat

ScriptAlias /cgi-bin/ /usr/local/lib/cgi-bin/
<Directory "/usr/local/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all

Your statistics are then usually accessible on your server, at this path:

Finally, add a crontab job, with crontab -e:

*/35   * * * * /usr/lib/cgi-bin/ > /dev/null

  • Created: 28/11/13 06:44
  • Modified: 28/11/13 06:44