User Tools

Site Tools


blog:configure_awstats_on_debian_webserver

This is an old revision of the document!


Configure awstats on debian webserver

AWStats on Debian

Install AWStats

aptitude update
aptitude awstats

Configure the apache2 for awstats

Copy configuration file for apache2.

cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf.d/awstats

Then edit /etc/awstats/awstats.conf file and make sure the file contains (double check the apache2 word)

LogFile="/var/log/apache2/access.log"
SiteDomain="mysite.org"
LogFormat=1

Now change a permission on apache log file

chmod o+r /var/log/apache2/access.log

Make it a default that access.log has these permissions.

Edit the /etc/logrotate.d/apache2 and make sure it has these lines

create 644 root adm
prerotate
  /usr/lib/cgi-bin/awstats.pl -config=awstats.www.mysite.org.conf  -update
endscript

Final file should look similar to :

/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 644 root adm
        sharedscripts
        prerotate
            /usr/lib/cgi-bin/awstats.pl -config=awstats.conf -update        endscript
        postrotate
                if [ -f /var/run/apache2.pid ]; then
                        /etc/init.d/apache2 restart > /dev/null
                fi
        endscript
}

Reload apache

/etc/init.d/apache2 reload

And visit:

http://localhost/cgi-bin/awstats.pl?config=awstat.conf or http://www.mysite.com/cgi-bin/awstats.pl?config=awstat.conf [Optional]

To make it easier to remember the address you can edit /etc/apache2/conf.d/awstats and add this line.

RedirectMatch ^/logs /cgi-bin/awstats.pl

Now you can access the awstats statistics by going to

http://www.mysite.com/logs

If you have a lot of old compressed logfiles that you would to include, set the logfile path to:

LogFile="zcat /var/log/apache2/servername.tld-access.log.*.gz |"

And update the database. This will incorporate all old log entries. Don't forget to switch back to the last logfile!

Ref: http://wiki.debian.org/Manual-Howto

~~LINKBACK~~

Discussion

Enter your comment. Wiki syntax is allowed:
  __  __   _  __   ____   ___   _____
 / / / /  / |/ /  / __/  / _ | / ___/
/ /_/ /  /    /  _\ \   / __ |/ (_ / 
\____/  /_/|_/  /___/  /_/ |_|\___/
 
blog/configure_awstats_on_debian_webserver.1277823037.txt.gz · Last modified: 2010-06-29 16:50 by brb