Awstats is an advanced graphical statistics software that can be used to analyze the webserver logs. Here we can see how we can install awstats on a linux server with Apache.


You can get the latest awstats from here. Login to server as root execute the below commands

# cd  /usr/local/
# wget
# tar -zxvf awstats-7.0.tar.gz
# mv /usr/local/awstats-7.0 /usr/local/awstats
# cd /usr/local/awstats/tools/
# perl

The above script will ask few questions, detect/modify your apache configuration and will generate an awstats configuration file for the site you specifies.


Awstats site configuration file path will be :  /etc/awstats/
Name Format of configuration file :

Open the configuration file with a desired text editor and check, verify and modify the below entries

LogFile —> Log file directive should mention the correct path of the site access log file
SiteDomain —> this directive should mention your domain name

Updating stats

You can update stats with the below command
# /usr/local/awstats/wwwroot/cgi-bin/ -update

Add it as a cron to generate the statistics periodically

# crontab -e

0 0 * * * /usr/local/awstats/wwwroot/cgi-bin/ -update >/dev/null 2>&1


To restrict access and to password protect the statistic information add the below lines in your apache configuration

<Files “”>
AuthUserFile /usr/local/awstats/.htpasswd
AuthGroupFile /path/to/.group
AuthName “Restricted Area”
AuthType Basic
require valid-user

You need to create a user and password and copy it to the file /usr/local/awstats/.htpasswd to limit the access. Any htpasswd online generator can be used for this, You can find an example one here

restart Apache

/etc/init.d/httpd restart


Awstats of the domain can be viewed with the url,