Filed under SEO, Web Hosting

Knowing your visitors is crucial to your website, especially if you’re generating an income from the traffic you get, whether it’s through sales or advertisement. That’s why it’s important to have good statistics about your site. You want to know where your visitors came from, how they found your site, which pages they’ve read, how long they stayed, how often they come back, etc.

While there are plenty of tools available, I’ll focus mainly on AwStats today. AwStats is a free and powerful tool that generates advanced statistics for many protocols including web, streaming, ftp and mail transfer. This log analyzer works as a CGI or from command line and generates statistics in HTML format.

Installing AwStats On Linux

  1. Get your copy of AwStats from SourceForge.net at
    http://sourceforge.net/project/showfiles.php?group_id=13764
  2. Extract all files from the archive and upload it to a temporary folder on your web server. This folder needs not to be accessible through HTTP.# tar xvzf awstats-[version].tar.gz
  3. Move all the content from the archive to /usr/local/awstats. When you’re done, this directory should contain:
    • ./docs
    • ./README.TXT
    • ./tools
    • ./wwwroot
  4. Change directory to /usr/local/awstats/tools and execute ./awstats_configure.pl# cd /usr/local/awstats/tools
    # ./awstats_configure.pl
  5. Go through the configuration script.
  6. Add a cron task to update statistics on a daily basis. To do this, simply create a new file named awstats_updateall.sh into /etc/cron.daily. This is the script’s content:#!/bin/sh
    /usr/local/awstats/tools/awstats_updateall.pl now
  7. Add execute permission to awstats_updateall.sh

    # chmod 0755 /etc/cron.daily/awstats_updateall.sh
  8. Create a directory named “awstats” into /var/lib.
  9. Verify that the following directives have been added to your httpd.conf file. If not, you will have to add them manually:#
    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/”
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory “/usr/local/awstats/wwwroot”>
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
  10. Edit your AwStats configuration to make sure all settings are correct. This file is located in /etc/awstats/awstats.[your domain name].conf
  11. Make sure your httpd access log file format is “combined”. To verify this, open /etc/httpd/conf/httpd.conf and look for:

    CustomLog [your log path]/access_log common
    andchange it to:

    CustomLog [your log path]/access_log combined
  12. Restart the httpd service:

    # service httpd restart
  13. Generate some statistics:

    # /etc/cron.daily/awstats_updateall.sh
  14. Try accessing AwStats through your web browser at http://[your domain name]/awstats/awstats.pl

That’s pretty much it!

You can read the AwStats documentation here : http://awstats.sourceforge.net/docs/index.html


Related Posts

Comments (0) Posted by Stephane on Tuesday, September 18th, 2007


You can follow any responses to this entry through the magic of "RSS 2.0" and leave a trackback from your own site.

Post A Comment