[Ref: Awstats]
Quick notes for installing AWSTATS within my environment:
Download the awstats files and extract to a known directory
# export SRC=/path/to/awstats-7.1.1
# cd $SRC
Set the appropriate permissions that we will require for using the files (such as other readable for the perl scripts, and ‘x’ for the directories:
# find . -type d -print -exec chmod +x "{}" ";"
# find . -type f -print -exec chmod +r "{}" ";"
Move the files into the appropriate locations for how we manage our websites.
# mv tools /usr/local/awstats
# mv wwwroot /var/www/awstats
# mkdir -p /etc/awstats
# mv /var/www/awstats/cgi-bin/awstats.model.conf /etc/awstats/
# mkdir -p /var/db/awstats
Set at least one perl script as executable awstats_configure.pl
# chmod + /usr/local/awstats/awstats_updateall.pl
Run the configuration to create some configuration files
# /usr/local/awstats/awstats_configure.pl
# perl /usr/local/awstats/awstats_configure.pl
Responses to prompt for httpd.conf:
Note that installation will make some modifications that will need review.
We’re using a path different from the standard install, and need to update the appropriate perl scripts:
File extract: /usr/local/awstats/awstats_updateall.pl and /usr/local/awstats/awstats_buildstaticpages.pl
my $Awstats='/var/www/awstats/cgi-bin/awstats.pl';
Likewise, the default configuration template awstat.model.conf and all our configuration files need to be updated to reflect the below:
File extract: /etc/awstat/awstat.model.conf
DirData="/var/db/awstats"
DirCgi="/awstats"
DirIcons="/awstatsicons"
Example customisation for our squid cache include:
File extract: /etc/awstat/awstat.squid-cache.conf
LogFile="/var/squid/logs/access.log"
File: /var/www/conf/modules/awstats.conf
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/var/www/awstats/classes/"
Alias /awstatscss "/var/www/awstats/css/"
Alias /awstatsicons "/var/www/awstats/icon/"
ScriptAlias /awstats/ "/var/www/awstats/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/var/www/awstats">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
/usr/local/awstats/awstats_updateall.pl now
Apache needs to run in chroot for a number of reasons, including:
File extract: /etc/squid/squid.conf
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/squid/logs/access.log combined