Fix AWStats Reports With Varnish 4 For All Domains

Varnish is a caching system that has the ability to speed up your server’s ability to display webpages. Varnish sits between the Internet & your other software. This means that AWStats is unable to report on your traffic. This article will outline one option for fixing this problem with Varnish 4.

NOTE: Varnish does not handle HTTPS traffic. This means that after following these instructions AWStats will only show non-HTTPS data.


This article assumes a few points that will need to be complete or in place before proceeding. They are:

  • CentOS 6 or 7 server
  • cPanel version 62.0 (build 17) or similar installed, and operating as normal
  • Varnish 4 installed, and operating as normal

Ok, I Have All Those Installed & Operating as Normal. What now?

  1. Log into your server via SSH as root
  2. Start the Varnish logging utility that outputs in Apache log format. For CentOS 6 run

    service varnishncsa start

    For Centos 7 run

    systemctl start varnishncsa

  3. Set varnishncsa to start if you server restarts

    chkconfig varnishncsa on

  4. AWStats Config File

    Update LogFile variable in the AWStats configuration file with the new log location /var/log/varnish/varnishncsa.log. By default this is in the ‘awstats’ folder inside the ‘tmp’ folder of your cPanel user’s home directory. The full path for this file usually looks something like /home/userna05/tmp/awstats/

  5. Change permissions for this file to prevent cPanel from overwriting these changes. Be sure to replace ‘userna05’ with your primary cPanel user name, and ‘’ with your primary domain.

    chmod 444 /home/userna05/tmp/awstats/

  6. Log into cPanel for your primary cPanel user.
  7. AWStats Icon

    Access AWStats

  8. find primary domain

    Find your primary domain on the list of available domains, and click View next to it

  9. click update

    Finally, click Update now at the top of the page.

Congratulations! You are now allowing AWStats to parse data from Varnish for all domains on your server.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Shop the Black Friday Sale
Hurry! These Deals Won't Last Long