SETTING AWSTATS ON CENTOS

 Commands 

1.yum install epel-release

2.INSTALL Apache if apache is not installed

# yum install httpd

# chkconfig httpd on

# service httpd start

3.INSTALL AWstats

# yum install awstats

4.Configure Apache for AWStats

# vi /etc/httpd/conf.d/awstats.conf

Alias /awstatsclasses “/usr/share/awstats/wwwroot/classes/”

Alias /awstatscss “/usr/share/awstats/wwwroot/css/”

Alias /awstatsicons “/usr/share/awstats/wwwroot/icon/”

ScriptAlias /awstats/ “/usr/share/awstats/wwwroot/cgi-bin/”

 

<Directory “/usr/share/awstats/wwwroot”>

Options None

AllowOverride None

<IfModule mod_authz_core.c>

# Apache 2.4

Require host 192.168.0.0/24 //Change this to your IP

</IfModule>

<IfModule !mod_authz_core.c>

# Apache 2.2

Order allow,deny

Allow from 192.168.0.0/24 //change this to your IP

Allow from ::1

</IfModule>

</Directory>

 

<IfModule mod_env.c>

SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins

</IfModule>

 

5.Restart Apache service to reload new settings

 

# service httpd restart

6.Create AWStats Configuration File

# cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.domain.name.conf

# vi /etc/awstats/awstats.domain.name.conf

7.Update below settings in awstats.domain.name.conf file

 

LogFile=”/var/log/httpd/domain.name-access_log”

SiteDomain=”domain.name”

HostAliases=”domain.name www.domain.name”

8.Now execute following command to update logs files

# sudo sh /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=domain.name -update

9.Schedule Cron to Update Logs

0 2 * * * /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=domain.name -update

10.Access AWStats in Browser

http://domain.name/awstats/awstats.pl?config=domain.name