AWStats is an open-source log analysis tool, offering robust capabilities for website owners and administrators to analyze their site traffic. It delivers comprehensive insights about website visitors, such as visitor count, geographic locations, visited pages, and more. Utilizing these insights, website owners can enhance their site’s performance and bolster their digital footprint.

Advertisement

This guide will provide instructions on installing AWStats on three widely-used Linux distributions: Ubuntu, Debian, and Linux Mint. The steps outlined have been verified on Ubuntu 22.04 LTS.

Prerequisites

Before beginning the AWStats installation, ensure that your system has Apache web server installed. If Apache is not already installed, you can do so with the following command:

sudo apt-get update 
sudo apt-get install apache2 

Step 1: Installing AWStats

AWStats required an web server to serve pages over world wide web (www). In case Apache is not present on your system, utilize the commands provided below to install both Apache2 web server and AWStats packages, along with any other necessary dependencies.

sudo apt install awstats 

Step 2: Configure Apache

Next, you’ll need to create a configuration file for AWStats in your Apache setup. Open your preferred text editor and create or modify the file located at /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>

Make sure to update Require host and Allow from IP range as per the Apache version.

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

sudo a2enmod cgi 
sudo a2enconf awstats 

Restart the Apache service to reload new settings

sudo systemctl restart apache2 

Step 3: Create AWStats Configuration File

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

sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.example.com.conf 
sudo nano /etc/awstats/awstats.example.com.conf 

Replace “example.com” in the above command with the name of your domain.

Now, update the following configuration settings in awstats.example.com.conf:

  • Set the log file path:
    
    LogFile="/var/log/apache2/example.com-access_log"
    
    
  • Set the domain name:
    
    SiteDomain="tecadmin.net"
    
    
  • Set the aliases for the host:
    
    HostAliases="example.com www.example.com"
    
    

Now execute the following command to update log files. The AWStats automatically detects already processed logs and ignore them. It will only process the new logs.

sudo /usr/lib/cgi-bin/awstats.pl -config=example.com -update 

Replace “example.com” in the above command with the name of your domain.

Step 4: Access AWStats

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

https://example.com/awstats/awstats.pl?config=tecadmin.net
Setting Up AWStats on Ubuntu & Debian
Awstats

Conclusion

In conclusion, AWStats is a valuable tool for website owners and administrators who want to understand the traffic on their websites. With its detailed statistics, website owners can make informed decisions about how to improve their website and reach their target audience. Installing AWStats on Ubuntu, Debian, and Linux Mint is a straightforward process that can be completed in a few simple steps. With this guide, you can easily install AWStats and start analyzing your website traffic to make informed decisions about how to improve your website. Whether you’re a beginner or an experienced user, this guide will help you get started with AWStats and make the most of its features.

Share.

6 Comments

  1. I get this error message at step 4 : Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats.
    Setup (‘/etc/awstats/awstats.conf’ file, web server or permissions) may be wrong.
    Check config file, permissions and AWStats documentation (in ‘docs’ directory).

  2. The Apache allow commands did not secure access to awstats.

    The /etc/awstats.—-.conf file has the parameter:
    AllowAccessFromWebToFollowingIPAddresses=””

    which worked nicely for me.

  3. Congratulations and thanks Rahul.I tryed before several long tutorial probably too old to install awstats and only your work with Debian Jessy.Just at the end have to change owner of /var/lib/awstats.It is by default awstats and it require to be www-data.

Exit mobile version