Setting up AWStats on OpenLiteSpeed

How Can We Help?
< Back
You are here:

Install AWStats

For Ubuntu/Debian:

apt install awstats -y

For CentOS8:

dnf install epel-release
dnf install awstats

Set up AWStats Config

You will need to create a configuration file for each website for which you wish to view statistics.

cp /etc/awstats/awstats.conf /etc/awstats/

Add the following entries to /etc/awstats/

HostAliases=" localhost"

Be sure to substitute the domain name and the access log path with your own settings.

Verify Your AWStats Settings

Build your initial statistics, which are generated from the current logs

/usr/lib/cgi-bin/ -update

The example returns:

From data in log file "/var/www/html/logs/access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 50)
Jumped lines in file: 50
Found 50 already parsed records.
Parsed lines in file: 146
Found 0 dropped records,
Found 0 comments,
Found 0 blank records,
Found 0 corrupted records,
Found 0 old records,
Found 146 new qualified records.

Display AWStats

Add symlink for both cgi-bin and icons to your document root

ln -sf /usr/lib/cgi-bin /var/www/html/cgi-bin
ln -sf /usr/share/awstats/icon/* /var/www/html/awstats-icon

Navigate to Web Admin at port 7080 > VirtualHosts > Name > Context, then create a CGI context with the following settings:

  • URI=/cgi-bin/
  • Path=/var/www/html/cgi-bin

Click the Save button and gracefully restart the web server. Now you can access your AwStats by visiting the URL, http://your-server-ip/cgi-bin/

Set up Cronjob to Update Logs(Optional)

Run the following command to setup cronjob:

crontab -e

Add the following rule:

*/30 * * * * root /usr/lib/cgi-bin/ -update