tis a small tutorial on Awstats, we suppose that you already have Apache installed and working on your serrver.

get and uncompress the program

you will need to get Awstats from (i used awstats-6.7.tar.gz for this tutorial)

so you can do something like:

cd /usr/local/ wget http://the_link_to_get_awstats

decompress and install awstats

tar zxvf awstats-6.7.tar.gz mv awstats-6.7 /usr/local/awstats chown -R root:www-data /usr/local/awstats chmod 750 /usr/local/awstats mkdir /var/cache/awstats chown www-data:www-data /var/cache/awstats

configure Awstats

to simplify things you can get some \"home made\" default configuration files and then modify them:

mkdir /etc/awstats cd /etc/awstats wget wget

then copy awstats.domaine.tld.conf to, you can repeat this for the web sites you wish to have Awstats statistics.

cp awstats.domaine.tld.conf

in your new file you\'ll need to modify:

LogFile=\"/var/log/apache/\" # this should be the apache log file of the vhost SiteDomain=\"\" # the domain name HostAliases=\"\"

Updating the statistics

we shall create a little script that will be executed by crontab

vi /usr/local/sbin/awstats-cronbin

and we should insert

#!/bin/bash perl /usr/local/awstats/wwwroot/cgi-bin/ -update perl /usr/local/awstats/wwwroot/cgi-bin/ -update

then make it executable

chmod +x /usr/local/sbin/awstats-cronbin

and now tell crontab to do something;

echo \"0 6,12,18,22 * * * root /usr/local/sbin/awstats-cronbin\" >> /etc/crontab

Apache configuration

to consult the stats we will be going through apache, you can have a global access to Awstats (bad) or make it available only to a virtual host (good). in this example i\'ll configure the subdomain for consulting the stats, this does however imply that you know something about Apache so you can adapt this to your setup..

<VirtualHost *:80> ServerName DocumentRoot /var/www/html/user/ CustomLog /var/log/apache2/ combined # Configuration pour Awstats <Directory \"/usr/local/awstats/wwwroot\"> Options None AllowOverride AuthConfig Order allow,deny Allow from all </Directory> Alias /awstatsclasses \"/usr/local/awstats/wwwroot/classes/\" Alias /awstatscss \"/usr/local/awstats/wwwroot/css/\" Alias /awstatsicons \"/usr/local/awstats/wwwroot/icon/\" ScriptAlias /awstats/ \"/usr/local/awstats/wwwroot/cgi-bin/\" </VirtualHost>

make sue that in each concerned virtual host the logs are created as follows for this is what Awstats will need to read from.

CustomLog /var/log/apache/domain.tld.log combined

now we need to restart apache, always check your configuration before otherwise your billions of visitors might not be able to access your advertisement server while you repare.. :]

apachectl configtest apachectl graceful

looking at stats

all you need to do is point your browser to the virtual host previously configured for this purpose, in this example it\'s, then to the awstats perl script with the domain name stats to consult as an argument. the part: will look in /etc/awstats for a file named

in short:


you can secure access with an .htacces file and/or directly from withing Apache\'s configuration:

<Files \"\"> AuthUserFile /var/www/.htpasswd # make sure you have this htpasswd file AuthGroupFile /dev/null AuthName \"mdp stp\" AuthType Basic require valid-user AllowOverride AuthConfig </Files>

for now we are done, you can now tweak and tell me about it if you\'d like

Leave a comment
You may use the following HTML tags: <p> <a> <strong> <b> <em> <i> <cite> <blockquote> <code> <pre>

Your comments WILL NOT be submitted to any third party (not even for anti spam verification).