This tutorial will help you get AWStats and Lighttpd working together. AWStats is an excellent log analyzer, and works well with Lighttpd. This tutorial assumes a working installation of Light and PERL.

Step 1. Download and Extract AWStats

  • Download AWStats
  • Extract the archive to the web directory on your system, e.g. /var/www/

Step 2. Configure lighttpd.conf

Fire up lighttpd.conf in your favorite editor. Make sure that mod_cgi is in your modules configuration.

server.modules = ( "mod_rewrite", "mod_fastcgi", "mod_status", "mod_cgi", "mod_accesslog" )

Add a separate host entry for your AWStats instance.

$HTTP["host"] =~ "awstats.YOURDOMAINNAMEHERE" {
cgi.assign = (
".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl"
server.document-root = "/YOUR_PATH_TO/awstats/wwwroot/"

Restart Lighttpd and point your browser to:

You should get an error message from AWStats, continue on to Step 3. If you get a 404 error message or Lighttpd didn't start, check your configuration file for syntax errors and correct paths.

Step 3. Configure AWStats

Copy cgi-bin/awstats.model.conf to cgi-bin/awstats.YOURDOMAINNAMEHERE.conf, and open that file in an editor.

  • Set the path to your log file
  • Set your Domain Name

You can add new configuration files for each site you would like AWStats to parse.

Step 4. Analyze Log Files

To update the stats, run the following command in the cgi-bin directory:

perl -update -config=YOURDOMAINHERE

To automate this command, check out my Crontab Tutorial.

Thanks to Jake Tracey for his post, which helped with this tutorial.