AWStats Installation (alternative)
From DreamHost
This alternative installation, configures Awstats to be dynamically updated, executed as a cgi script. This allows Awstats to show frames in the web stat pages, but most important, it allows the viewing of previous months' data, as well as real-time statistics update through the browser.
This is a much more flexible alternative, but it is also much more demanding on the server. Read the main AWStats_Installation page for detailed instructions for some of these steps.
- This guide assumes that your username is yourusername and your domain is mydomain.com. You should change it to fit your username and domain. It also assumes awstats as the folder you what to install (DH uses 'mydomain.com/stats' as a default for their Analog statistics.)
Change to your domain directory:
cd mydomain.com
Download the latest version of AWStats here
wget http://awstats.sourceforge.net/files/awstats-6.9.tar.gz
Extract the files
tar xfzv awstats-6.9.tar.gz
Delete the tar file (optional):
rm -rf awstats-6.9.tar.gz
Rename the newly created folder to whatever you like
mv awstats-6.9 awstats
Change to the newly renamed folder
cd awstats
Remove all the files and folders except in the 'wwwroot' folder.
rm -rf README.TXT rm -rf docs rm -rf tools
Move the contents of wwwroot in to the current directory
mv wwwroot/* .
Delete the now unneeded wwwroot directory (optional):
rm -rf wwwroot
Change to the cgi-bin directory.
cd cgi-bin
Make copies of the model configuration file for each domain you want to report.
cp awstats.model.conf awstats.mydomain.com.conf cp awstats.model.conf awstats.mydomain2.com.conf cp awstats.model.conf awstats.mydomain3.com.conf
Edit the config file lines shown below, as shown. You can edit the config file by downloading it, using a text editor on your PC and uploading it back to the cgi-bin directory, or by using vi, pico or another text editor.
LogFile="/home/yourusername/logs/mydomain.com/http/access.log" SiteDomain="mydomain.com" HostAliases="REGEX[mydomain\.com$]" DirData="/home/yourusername/mydomain.com/awstats" DirIcons="/awstats/icon" AllowToUpdateStatsFromBrowser=1
That should do it. To test it out, open:
http://mydomain.com/awstats/cgi-bin/awstats.pl?config=mydomain.com
You can update the stats from your browser. If you want to use crontab, insert this line in your crontab (type crontab -e to open).</br>
0 * * * * /home/yourusername/mydomain.com/awstats/cgi-bin/awstats.pl -config=mydomain.com -update >/dev/null
This will update the stats every hour.
500 Internal Server Error
If you are getting the "500 Internal Server Error" in your browser and/or "Premature end of script headers" message in your server error log, ensure your scripts are NOT writable by anyone but the owner user. This is because Dreamhost runs suexec, as described in the Knowledge Base. Try doing the following (where aw is the awstats folder):
chmod -R 755 aw
Related Links
AWStats - Main page
AWStats_Installation - Main installation page

