Ruby, Rails, Firefox, Anime, Mac
In: Web development28 Aug 2004
First, emerge the awstats package. I added the “vhosts” USE flag because it’s listed as a USE flag that awstats reads, and I need support for virtual hosts (although I don’t know for sure what it does – I reckon it has something to do with the webapps-config package that’s a dependency).
Don’t use the webapp-config program that the emerge process tells you to use at the end unless you know what you are doing. There have been reports that it isn’t exactly ideal in the Gentoo forums.
Make a symbolic link to the Apache configuration directives we need to add to Apache in a convenient location. You may also want to make the file owner-writable (chmod u+w) since it’s read-only.
I had to add this bit to /etc/apache2/conf/awstats.conf prevent a 403 error when accessing the ScriptAliased /awstats directory.
Include the AWStats-required configuration directives in the main Apache config file (mine’s /etc/apache2/conf/apache2.conf).
I’m using name-based virtual hosts, with logs for each of them (they are in the included vhosts/vhosts.conf file). AWStats by default parses the Combined log format and this is what I specify for my access logs as well. An example VirtualHost directive:
Now, create an AWStats configuration file for each virtual-host.
Notice that the configuration file name is of the format “awstats.domain.tld.conf”.
Edit the configuration file (/etc/awstats/awstats.blog.codefront.net.conf). The important things to change are:
You can access AWStats from www.example.com/awstats/awstats.pl?config=www.example.com.
Set password-protection for the AWStats directory.
Run AWStats from the command line to update it. You’d likely want to set up a cron job for this.