How to Install AWStats (Apache Log Analyzer) on Ubuntu, Debian & LinuxMint

Channel: Linux
Abstract: Step 2 – Configure Apache Now create Apache configuration file for awstats setup. Use your favorite text editor and edit a new file /etc/apache2/conf-

AWStats is a free and very powerful tool that creating statics by analyzing Apache log files, ftp or mail servers. AWStats log analyzer works on CGI or command line interface and generate graphical statics from log files.

This tutorial will help you to install AWStats Apache Log Analyzer on Ubuntu, Debian and LinuxMint systems.. This article has been tested with Ubuntu 14.04 LTS only.

Step 1 – Install AWStats & Apache Package

AWStats required Apache web server to be running. If you don’t have Apache install Use below commands to install Apache2 web server and awstats packages. It will also install all other required dependencies.

$ sudo apt-get install awstats apache2
Step 2 – Configure Apache

Now create Apache configuration file for awstats setup. Use your favorite text editor and edit a new file /etc/apache2/conf-available/awstats.conf.

$ sudo nano /etc/apache2/conf-available/awstats.conf

Now add the following configuration

ScriptAlias /awstats/ /usr/lib/cgi-bin/
Alias /awstats-icon/ /usr/share/awstats/icon/
Alias /awstatsclasses/ /usr/share/java/awstats/

<Directory "/usr/lib/cgi-bin/">
    Options None
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require host 192.168.0.0/24
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from 192.168.0.0/24
        Allow from ::1
    </IfModule>
</Directory>

Now enable CGI module (if not enabled) and Also enable Awstats apache configuration.

$ sudo a2enmod cgi
$ sudo a2enconf awstats

Restart Apache service to reload new settings

$ sudo service apache2 restart
Step 3 – Create AWStats Configuration File

It’s required to create a configuration file for each of your website for which statics need to generate. Copy AWStats example configuration file with new name and make changes as below.

$ sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.tecadmin.net.conf
$ sudo vim /etc/awstats/awstats.tecadmin.net.conf

Update below settings in awstats.tecadmin.net.conf file

LogFile="/var/log/apache2/tecadmin.net-access_log"
SiteDomain="tecadmin.net"
HostAliases="tecadmin.net www.tecadmin.net"

Now execute following command to update logs files

$ sudo /usr/lib/cgi-bin/awstats.pl -config=tecadmin.net -update
Step 4 – Access AWStats in Browser

Use your server ip address or domain name to access AWStats statics. Change domain name at the end of url as per your settings.

https://tecadmin.net/awstats/awstats.pl?config=tecadmin.net

Congratulation’s! you have successfully configured AWStats for you website. Read our next article to Setup vnStat ( Web-based Network Monitoring Tool ) and Install Munin Network Monitoring Tool on your Linux system.

Ref From: tecadmin

Related articles