Install AWStats on Debian Wheezy

Install AWStats to analyse Apache log files.


This article assumes that you have an Apache webserver installed and running already.

# apt-get install awstats


Open /etc/awstats/awstats.conf for editing and change the following lines:

# This is where your Apache log goes

# For Apache combined logs

# The main domain name used to reach the website


Create a webroot for awstats website:

# mkdir /var/www/awstats 
# ln -s /usr/share/awstats/icon /var/www/awstats/icon

Create a config file:

# touch /etc/apache2/sites-available/awstats.conf

Open the file above for editing and add the following lines:

<VirtualHost *:80>
    ServerAdmin [email protected]

    DocumentRoot /var/www/awstats
    <Directory />
      AuthGroupFile /dev/null
      AuthType Basic
      AuthUserFile /var/www/awstats/.htpasswd
      AuthName "Access Restricted"
      Require valid-user
      AuthType Basic

      Order deny,allow
      Deny from all
      Allow from

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
      AllowOverride None
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

      Order deny,allow
      Deny from all
      Allow from

Change the subnet above ( to match your network configuration.

Create a new password .htpasswd file for user sandy for basic Apache authentication:

# htpasswd -c /var/www/awstats/.htpasswd sandy

Enable awstats website:

# cd /etc/apache2/sites-available/
# a2ensite awstats.conf

Test configuration:

# apachectl configtest
Syntax OK

Restart Apache:

# /etc/init.d/apache2 restart

Generate Reports

# /usr/lib/cgi-bin/ -config=apache -update
# /usr/lib/cgi-bin/ -config=apache -output -staticlink > /var/www/awstats/index.html

Generate reports automatically every hour:

# crontab -l
0 * * * * /usr/lib/cgi-bin/ -config=apache -update
5 * * * * /usr/lib/cgi-bin/ -config=apache -output -staticlink > /var/www/awstats/index.html

4 thoughts on “Install AWStats on Debian Wheezy

Leave a Reply

Your email address will not be published. Required fields are marked *