Changing AWStats Config File in cPanel

Your hosting company offers you a pre-installed version of AWStats in cPanel. That’s great, but sometimes you would like to change the AWStats setup to better suit your needs. This is not as easy as it looks like.

Did you ever try to edit the AWStats configuration file in cPanel ? It can be a tricky game.

Where is the AWStats config file ?

The AWStats config file is located in the /tmp/awstats/ directory.

It is called awstats.your_site_name.conf, where your_site_name is the name of your web site.

Why is it tricky ?

You have located the file, you download it to your computer, you edit it and you upload it to the server again and you believe that you are done…

This will probably not work because, in most installations, cPanel reinitializes the AWStats configuration file every day, just before it runs the stats update.


There are two possible solutions.

1. Changing the file permissions

This first solution is obvious, but it does not always work. Connect to the site with FTP and try to change the permissions of awstats.your_site_name.conf to “read only” (444).

If your hosting company does not allow you to change these permissions, try our second workaround.

2. Creating a customized AWStats config file

Download awstats.your_site_name.conf to your computer, edit it and upload it as awstats.customized.conf in the /tmp/awstats/ directory of the server.

As you have now created a new configuration file, you also have to schedule your own updates based on this config file. To do this, log in cPanel and click on “Cron jobs” in the “Advanced” menu, then click on “Advanced (Unix Style)“.

You have to add a line to the list of task:

  • enter the “minute” and “hour” of your choice. You have to run the update when the log file of the day before is available. Look in your regular AWStats report at what time the system typically runs the update and run your update an hour later.
  • write an asterisk * in the “day”, “month” and “weekday” columns. It means that the update must be done every day of every month.
  • write the following command in the last column
    /usr/local/cpanel/3rdparty/bin/ -config=customized -update 2>&1 > /dev/null

Click on “Commit Changes” and log out from cPanel.

Now everything should be working fine. To view your new report with your browser, go to your “old” AWStats report first and replace “config=your_site_name” by “config=customized” in the address bar. This modified address will be the new web address of your AWStats reports.

3 Responses to “Changing AWStats Config File in cPanel”

  1. Kamil Wójcicki says:

    Cheers for this helpful info! Workaround #2 worked for me without a glitch. Kamil

  2. Jonathan Lamb says:

    I tried Workaround #1 but the server wouldn’t allow permission change through an FTP client. But, I spoke with customer service and found that you can change file permissions using the Legacy File Manager on cPanel. So, try that first, before going to the work of setting up the cron job and everything. It worked for me and saved plenty of time!

  3. Fred Dibnah says:

    Thanks Jonathan for posting the ‘Legacy File Manager’ trick, worked perfect for me when I couldn’t use my FTP program. +1


Leave a Reply

You must be logged in to post a comment.