awstats
1) Installation
#yum install epel-release
#yum install httpd
#chkconfig httpd on
#service httpd start
#yum install awstats
2) Configuration
a) Changes in log format in httpd.conf
check the below entry for log format. if it does not exist then add it.
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
b) changes in virtualhosts
change your log configuration like below
CustomLog logs/yourdomain.com-access_log combined
c) configuring awstats.conf for apache
#vim /etc/httpd/conf.d/awstats.conf
add below entries in <Directory "/usr/share/awstats/wwwroot">
</Directory> container
AuthUserFile "/path-to-file/.htpasswd"
AuthName "Restriceted Access"
AuthType Basic
Require user "htuser"
Then create password file by below command
#htpasswd -c /path-to-file/.htpasswd htuser
#chmod 404 /path-to-file/.htpasswd htuser
d) creating configuation file for awstat
#cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/yourdomain.com.conf
then edit the file /etc/awstats/yourdomain.com.conf
# vim /etc/awstats/yourdomain.com.conf and change the below entries according to domain
LogFile="/var/log/httpd/yourdomain.com-access_log"
SiteDomain="yourdomain.com"
HostAliases="yourdomain.com www.yourdomain.com"
( for multiple domains its better to create seperate files for each domain)
e) setting permissions
now change permissions for the awstat folder
#find /usr/share/awstats -type d -exec chmod 701 '{}' \;
#find /usr/share/awstats -type f -exec chmod 404 '{}' \;
#chmod +x /usr/share/awstats/wwwroot/cgi-bin/awstats.pl
#chmod 400 /etc/awstats/*.conf
Once you make all the changes make sure to restart apache to get configuration changes into effect
#/etc/init.d/httpd stop
#/etc/init.d/httpd start
or #/etc/init.d/httpd restart
make necessary changes according to your domain in below url to check the statistics
http://www.yourdomain.com/awstats/awstats.pl?config=yourdomain.com