AWStats is a powerful, open-source log analyzer tool that helps website owners and administrators understand the traffic on their websites. It provides detailed information about the visitors to the website, including the number of visitors, their geographical location, the pages they visited, and more. With this information, website owners can optimize their websites and improve their online presence.
In this article, we will show you how to install AWStats on Ubuntu, Debian, and Linux Mint, three popular Linux distributions. This article has been tested with Ubuntu 22.04 LTS.
Prerequisites
Before we start the installation, make sure that you have the Apache web server installed on your system. If not, you can install it by running the following command:
sudo apt-get update
sudo apt-get install apache2
Step 1: Installing AWStats
AWStats required an Apache web server. If you don’t have Apache installed Use the below commands to install the Apache2 web server and AWStats packages. It will also install all other required dependencies.
sudo apt install awstats
Step 2: Configure Apache
Now create an 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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:1LogFile="/var/log/apache2/example.com-access_log"
- Set the domain name:1SiteDomain="tecadmin.net"
- Set the aliases for the host:1HostAliases="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

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.
6 Comments
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).
with ubuntu 20.04, I get this error message
hey,
could you run this command again in 2021.I bet those visitors numbers are off the roof
https://tecadmin.net/awstats/awstats.pl?config=tecadmin.net
lol
Hi, It is showing the dashboard but no data. Can you please hep me to resolve. Thank you
The Apache allow commands did not secure access to awstats.
The /etc/awstats.—-.conf file has the parameter:
AllowAccessFromWebToFollowingIPAddresses=””
which worked nicely for me.
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.