How To Access AwStats Outside cPanel

May 16th, 2008 · 1 Comment

AwStats is my favorite web statistics tool. For cPanel users, there’s no installation needed, AwStats is already installed. But there are times when you want some people to access their website’s statistics but you don’t necessarily want to give them access to cPanel.

This tutorial will show you how you can make AwStats accessible outside cPanel.

  1. Get yourself a copy of AwStats from http://awstats.sourceforge.net. The latest version available at the time of this writing is AwStats 6.7.
  2. Extract the content from the archive to your hard drive.
  3. Using an FTP client, create a directory at the root of your website (ie.: /public_html) and name it “stats” (or whatever you’d like to call it). At this point your directory should be accessible like this: http://www.yourwebsite.com/stats
  4. Next upload the content from awstats-6.7\wwwroot\cgi-bin to your stats directory you’ve just created.
  5. Using your FTP client, change the file permissions on awredir.pl and awstats.pl to 755 so that anyone can execute these scripts.
  6. Still using FTP, download the AwStats configuration file created by cPanel to your computer. This file is usually located in /tmp/awstats/awstats.[your website].conf
  7. Upload this file back to your web hosting account in your /public_html/stats folder.
  8. Create a directory named images in /public_html (ie.: /public_html/images).
  9. Upload the AwStats icon folder (ie.: awstats-6.7/wwwroot/icon) to your images folder you’ve just created. Rename the icon folder to awstats (ie.: /public_html/images/awstats).


At this point, you should now be able to access AwStats with this URL: http://www.yourwebsite.com/stats/awstats.pl?config=yourwebsite.com

But we’re not over yet. We don’t want everybody to access our statistics!

  1. Log in cPanel and click on the Password Protect Directories icon. Browse to your public_html directory and select the stats folder.
  2. Check the Password protect this directory checkbox and enter a name for the protected directory (you can enter whatever you want, it doesn’t matter). Click on the Save button when done.
  3. You should get a confirmation message saying that the directory is now protected. Click the Go Back link.
  4. In the Create User section, enter the username and password you want to use to access AwStats and click on Add/modify authorized user.
  5. Now try to access AwStats (http://www.yourwebsite.com/stats/awstats.pl?config=yourwebsite.com)  again to make sure it is protected.

Note for Wordpress users: password-protecting a subdirectory will not work because of the redirections instructions in the .htaccess file at the root of your website. While it’s not impossible to make it work, it’s easier to create a subdomain for awstats (ie.: http://stats.yourwebsite.com).

Ok great we can now access AwStats outside cPanel. But we can make things even easier. How about accessing your stats at http://www.yourwebsite.com/stats and not having to specify the configuration file?

  1. Using Notepad, create a file named index.php on your computer and add the following content:

    <?php header(”Location: awstats.pl?config=yourwebsite.com”); ?>

  2. Upload this file in your stats folder (ie.: /public_html/stats)

Now try to open http://www.yourwebsite.com/stats with your web browser. You should now be prompted for a username and password. You will then be redirected automatically to your statistics page!

That’s it, you’re done!

1 response so far ↓

1. Response by : Jan on Jul 16, 2008 at 3:17 pm

This is the best and most straight-forward explanations on how to access AwStats outside of cPanel I’ve found on the Internet. Great job!

Leave a Comment




Posted in Control Panels · Tutorials | 1 Comment

Dedicated Servers
 
VPS
Website Hosting
 

Recent Comments

Recent Webmasters

Hosting Type :
Monthly Price :
Storage :
Transfer :
Sort By :
Search