Awstats

Awstats Installation

Today i have installed awstats for the site mail.bizhat.com. The site is hosted on FreeBSD server with no control panel. Installing software from FreeBSD ports is really easy.

            # cd /usr/ports/www/awstats
            # make
            # make install
            # make clean
            

Now awstats is installed on you server and we need to configure it. To configure edit httpd.conf (vi /usr/local/etc/apacheX/httpd.conf) file and add following lines.

            Alias /awstatsclasses "/usr/local/www/awstats/classes/"
            Alias /awstatscss "/usr/local/www/awstats/css/"
            Alias /awstatsicons "/usr/local/www/awstats/icons/"
            ScriptAlias /awstats/ "/usr/local/www/awstats/cgi-bin/"

            <Directory "/usr/local/www/awstats/">
                Options None
                AllowOverride None
                Order allow,deny
                Allow from all
            </Directory>
            

Restart web server with "apachectl restart" command. After restarting you will be able to access awstats on page http://yourdomain/awstats/aswtats.pl, In my case the url look like http://mail.bizhat.com/awstats/awstats.pl

On going to awstats url, you will see some errors, this is because, you have not yet configured awstats completely. To configure awstats, do the following.

            # cd /usr/local/www/awstats/cgi-bin
            # cp awstats.model.conf awstats.mail.bizhat.com.conf
            # vi awstats.mail.bizhat.com.conf
            

NOTE: mail.bizhat.com is the domain name for which i am configuring awstats. In your cause, you should replace mail.bizhat.com with your own domain name.

We will now edit the file awstats.mail.bizhat.com.conf and change following parameters

            LogFile="/var/log/httpd-access-mail.log"
            SiteDomain="mail.bizhat.com"
            HostAliases="mail.bizhat.com localhost 127.0.0.1"
            DirData="/usr/local/www/awstats/data"
            DirCgi="/awstats"
            EnableLockForUpdate=1
            PurgeLogFile=1
            

Lets make data directory

            # mkdir /usr/local/www/awstats/data
            # chmod 777 /usr/local/www/awstats/data
            

Now going to awstats url, you will see awstats page. But no stats, this is because we have not yet processed the log file. Lets go ahead and process the log files.

            # cd /usr/local/www/awstats/cgi-bin/
            # ./awstats.pl -config=mail.bizhat.com -update
            

You need to run this everyday, so that awstats will show updated stats. Following is the cronjob i run. Use "crontab -e" to edit cron jobs.

10 0 * * * root /usr/local/www/awstats/cgi-bin/awstats.pl -config=mail.bizhat.com -update >> /var/log/awstats

Get in touch with us

Questions? Concerns? Comments? We want to hear from you!
Drop us a line with whatever is on your mind and we will get back to you ASAP!!