HOWTO Setup AWStats

From Research
Revision as of 19:33, 12 October 2005 by Mmmark (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This shows how to setup awstats on an apache server with vhosting. Make sure you have the vhosts use variable set on Gentoo. This article is aimed for AWStats on tirpitz.

Install AWStats

# emerge awstats

Use webapp-config

The standard projects directory must be listed in /etc/vhosts/webapp-config using the VHOST_ROOT variable. Currently this is set for any project that exists in: /home/projects/*/htdocs, as most projects on tirpitz have their webspace here.

To setup another project, use webapp-config to add it to your project's htdocs directory:

Note: I don't think this is necessary anymore.

# webapp-config -I -h <projectname> -u root -d /awstats awstats 6.5

webapp-config will output a lot of text, ignore it.

Apache VHost Configuration

Copy this following section into your vhost file: /etc/apache2/vhosts.d/<projectname>.conf

# awstats
Alias /awstats/classes "/usr/share/webapps/awstats/6.5/htdocs/classes/"
Alias /awstats/css "/usr/share/webapps/awstats/6.5/htdocs/css/"
Alias /awstats/icons "/usr/share/webapps/awstats/6.5/htdocs/icon/"
ScriptAlias /awstats/ "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/"
ScriptAlias /awstats "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl"
ScriptAlias /awstats.pl "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl"

<Directory "/usr/share/webapps/awstats/6.5/htdocs">
    Options None
    AllowOverride None
    <IfModule mod_access.c>
        Order allow,deny
        Allow from all
    </IfModule>
</Directory>
<Directory "/usr/share/webapps/awstats/6.5/hostroot/cgi-bin">
    Options ExecCGI
    AllowOverride None
    <IfModule mod_access.c>
        Order allow,deny
        Allow from all
    </IfModule>
</Directory>
# awstats

Create the AWStats Config File

# cd /etc/awstats
# cp awstats.researchtemplate.conf awstats.<projectname>.conf

Now edit that file to suit your project.

Note: most of this information is in your apache vhost file: /etc/apache/vhosts.d/<projectname>.conf

These are the variables you need to edit:

  • LogFile="/var/log/apache2/<projectname>/access_log"
  • SiteDomain="<projectname>.research.iat.sfu.ca"
  • HostAliases"<projectname>.research.iat.sfu.ca www.<projectname>.research.iat.sfu.ca localhost 127.0.0.1 REGEX[myserver\.com$]"

These HostAliases must match all ServerAliases ion your vhosts config file!

  • DirData="/home/projects/<projectname>/htdocs/awstats

Restart apache for the settings to take effect

# /etc/init.d/apache2 restart

Schedule Daily Log Updates

Add the project to the daily cronjob: /etc/cron.daily/awstats

/usr/share/webapps/awstats/6.5/hostroot/cgi-bin/awstats.pl -config=<projectname> -update

Run that command once for the logs to be analysed the first time.

Access the Stats Website

http://research.iat.sfu.ca/awstats.pl?config=<projectname>