Installing Awstats to monitor a subdomain

Awstats is an excellent way of tracking your website’s traffic and is one of the first things I install onto any new domain. However, the standard installation of Awstats monitors the overall domain, what if we wanted to be more specific and monitor a sub domain? For example, your main website is www.helloworld.co.uk and you have a blog installed to a subdomain: blog.helloworld.co.uk.

Step 1 – install Awstats to this subdomain

The subdomain will be linked to a folder in your file manager, the folder will share the same name as your sub domain. Install Awstats to this folder, using the sub-folder ‘Awstats’ (which will be created during install).

Step 2 – make some changes to Awstats so it only monitors the subdomain

If you only want it to monitor the subdomain you will need to edit the awstats.conf file and change the line

LogFile=”zcat -f `find /home/sites/helloworld.co.uk/logs/ -name ‘*-access_log*’ -newer dnscachelastupdate.txt | sort -r` |”

to

LogFile=”zcat -f `find /home/sites/uponnothing.co.uk/logs/ -name ‘blog.helloworld.co.uk-access_log*’ -newer dnscachelastupdate.txt | sort -r` |”

And then change:

SiteDomain=”helloworld.co.uk”

and

HostAliases=”localhost 127.0.0.1 REGEX[helloworld.co.uk$]”

To:

SiteDomain=”blog.helloworld.co.uk”

and

HostAliases=”localhost 127.0.0.1 REGEX[blog.helloworld.co.uk$]”

Awstats should now just be monitoring the statistics for your blog. You can of course install another Awstats to your main domain and leave it as installed and it will monitor your entire site. This gives you more detailed statistics about how certain parts of your website are performing.

Step 3 – Password protect your web statistics

It is recommended you add a password to your Awstats folder so that only you can view your statistics. To to this you need to use ‘Password Protection’ which is in the ‘Web tools’ section of your eXtend Control panel. The directory name to password protect in this instance would be: http://www.helloworld.co.uk/blog/awstats

  1. No comments yet.
(will not be published)