Home » Centos/RHEL » Apache » AWSTATS installation and configuration on Centos and RHEL

AWSTATS installation and configuration on Centos and RHEL

This tutorial will describe you AWSTATS installation and configuration on Centos and RHEL server.
AWStats is a free as well as opensource powerful and featureful tool, that initiate very useful graphically statistics for web, mail server, ftp server. This log analyzer reporting tool run as a CGI or from cli (command line interface) and display all possible information server log contains, in several GUI web pages. It normally makes use of a partial data record to be able to manner massive log documents, often and quickly. it could examine log files from all types of server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log layout) and numerous different web, proxy, wap, streaming servers, mail servers and some ftp servers. take a look at this evaluation desk for an concept on capabilities and variations between maximum well-known records gear (AWStats, Analog, Webalizer,…).
AWStats is a loose software program distributed underneath the GNU preferred Public License. you can have a have a look at this license chart to realize what you could/can not do.
As AWStats works from the command line however additionally as a CGI, it may works with all internet web hosting companies which permit Perl, CGI and log get right of entry to.This tutorial will describe you AWSTATS installation and configuration on Centos and RHEL server

AWSTATS have the following features.

Number of visits, and number of unique visitors,
Visit time duration and last visits
Host List, Last vist resolved and un-resolved ips.
Days, Weeks and hours
Search Engines, Robot, Worm Attacks, HTTP ERROR
Most viewed, exit pages.

Install the awstats and perl

[root@linuxpcfix.com]# yum install awstats perl

By default AWStats generates an Apache configuration file /etc/httpd/conf.d/awstats.conf. Default configuration of awstats use allow from all access. If you want to access awstats from particular network then modefy the allow from ip with your system or network ip.

[root@linuxpcfix.com]#vi /etc/httpd/conf.d/awstats.conf
Alias /awstats/icon/ /var/www/awstats/icon/
ScriptAlias /awstats/ /var/www/awstats/

DirectoryIndex awstats.pl
Options ExecCGI
order deny,allow
allow from all
allow from

#Alias /css/ /var/www/awstats/css/
#Alias /js/ /var/www/awstats/js/

Create awstats configuration file for each webdomain
You need to creates awstats configuration file for each domains, So copy default example configuration file.

[root@linuxpcfix.com]# cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.webdomain1.com.conf
[root@linuxpcfix.com]# cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.webdomain2.com.conf

Then uncomment the following lines as given below.

HostAliases=”linuxpcfix.com www.linuxpcfix.com”

Run the following command to update the logs file

[root@linuxpcfix.com]# perl /var/www/awstats/awstats.pl -config=linuxpcfix.com -update

Setup daily cron job to update logs file.
Schedule a daily cron job to update AWStats database using newly created logs entries.

0 10 * * * /usr/bin/perl /var/www/awstats/awstats.pl -config=linuxpcfix.com -update

Access AWSTAT using browser.
Finally now the time to access awstat by using your server ip address or domain name replace domain name at the end of url as per your settings.

Cheers! You have successfully installed the AWSTATS for you domains. The same steps will applicable for multiple websites.
In addition you need to install GeoIP plugins to see the country of user’s ip address.

[root@linuxpcfix.com]# cd /var/www/awstats/plugins
[root@linuxpcfix.com]# wget wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
[root@linuxpcfix.com]# gunzip GeoIP.dat.gz

Make AWSTAT directory password protected using .htaccess.
Secure the Awstats directory by creating an htpasswd file and adding the .htaccess file to authenticate against it. So open the file /var/www/awstats/.htaccess and append the following lines.

[root@linuxpcfix.com]#vi /var/www/awstats/.htaccess
AuthName “STOP – Do not continue if you are not authorized user to view this site! – Server Access”
AuthType Basic
AuthUserFile /etc/awstats/htpasswd
Require valid-user username

To generate the htpasswd file for user execute the given below command.

[root@linuxpcfix.com]# htpasswd -c /etc/awstats/htpasswd username

that’s IT!


I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry from last 7 years.

Leave a Reply

Your email address will not be published. Required fields are marked *


Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud