90.5 AWStats

20210824 A straightforward web log analyser and summary generator is awstats. Install the package:

wajig install awstats

Enable cgi scripts if they have not already been enabled:

sudo a2enmod cgi

Take a copy of a default AWStats configuration file for our local configuration:

sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.abc.com.conf

Edit the configuration file to set the SiteDomain parameter, which is required for AWStats:

$ sudo emacs /etc/awstats/awstats.abc.com.conf


Always good to restart the web server for a new configurations to take effect:

wajig restart apache2

We now have a statistics summary page at http://abc.com/cgi-bin/awstats.pl.

You will need to enable icons by adding the following line into a new apache2 configuration file:

$ sudo emacs /etc/apache2/sites-enabled/awstats.conf

Alias /awstats-icon/ /usr/share/awstats/icon/

Restart the web server for a nice looking page.

wajig restart apache2

The initial summary log file can now be populated with:

sudo /usr/lib/cgi-bin/awstats.pl -config=abc.com -update

This can be setup for cron to run every 10 minutes:

*/10 * * * * /usr/lib/cgi-bin/awstats.pl -config=abc.com -update

Ne sure to protect the website with a password stored in /var/www/html/.htpasswd:

$ sudo htpasswd -c /var/www/html/.htpasswd fred
New password: 
Re-type new password: 
Adding password for user fred

Enable the password by adding the following configuration:

$ sudo emacs /etc/apache2/sites-enabled/awstat.conf

<Files awstats.pl>
AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /var/www/html/.htpasswd
Require valid-user

Be sure to restart the apache2 server again.

Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.