How to Install AWStats on HostRocket sites

This tutorial may work on other hosts as well, but please make sure that your hosts allows you to install AWStats first.

Automatically update your stats via crontab

It's a good idea to automatically update your stats so that you don't have to keep updating them from the browser. To do this, setup a crontab. You can go into your control panel and click on crontab and click on Advanced (Unix Style). The first five boxes control how often the crontab is run and the last box is the action that is performed. I run my stats every three hours, so my crontab looks like * */3 * * * /home/USERNAME/public_html/cgi-bin/awstats.pl -config=www.domain.com -update. Replace USERNAME in the command with the username that you use to log into your control panel and replace www.yourdomain.com with your site's actual domain. The */3 in the hour box means that the crontab will run every three hours. If you want it to run every four hours, you would put in */4.

Password Protect your AWStats file

It's also a good idea to password protect your AWStats file for a few reasons: your competitors seeing your keywords and referreres, spammers, and malicious people that will constantly update your stats causing an increase in server load and your site being suspended. So, to protect the file, we have to use .htaccess and .htpasswd. Open up notepad and put in

#password protect awstats.pl
AuthType Basic
AuthUserFile "/home/USERNAME/.htpasswd"
AuthName "Restricted Function"
Allow From All
<Files awstats.pl>
require valid-user
</Files>

Where it says AuthUserFile, this is going to be the location of your .htpasswd file. Replace USERNAME with the username that HostRocket gave you. Save this file as htaccess.txt

Next you need to create a username and a password to log in. The username and password do not have to be the same as the ones HostRocket gives you. Create another new notepad file. Then go to 4WebHelp .htpasswd Encryption Tool to put in the username and password you choose. It will output an encrypted password. If you put in a username of User and a password of Pass, you would be given something like this: User:568BmSWhHSXcw. Copy and paste the username and encrypted password given into the new notepad file and save it as htpasswd.txt

Now, upload the .htpasswd file to your root directory (that is the directory where you will see files like www, public_html, tmp, and public_ftp. After it has been uploaded, you will need to rename htpasswd.txt to .htpasswd. Then go into your public_html or www folder and upload the htaccess.txt file there. You will also need to rename htaccess.txt to .htaccess. Make sure both files are uploaded in ASCII mode, not Binary mode (many ftp programs will automatically do this for you). Go to your awstats.pl page again and make sure it asks you for a username and password. Put in your username and the non-encrypted password and you should be all set!

Opera
Valid CSS!
Valid XHTML 1.0 Strict
HostRocket Web Hosting