Differences between current version and predecessor to the previous major change of AwStatsNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 4 Last edited on Monday, August 21, 2006 8:56:53 am by CraigBox
Older page: version 1 Last edited on Friday, July 21, 2006 10:09:36 am by CraigBox Revert
@@ -1,11 +1,11 @@
-!!Debian/Ubuntu AWStats virtual host setup 
+! !!Debian/Ubuntu AWStats virtual host setup 
 Install awstats with <tt>apt-get install awstats</tt>. To get geostats working, so you can tell the countries of origin of your visitors, <tt>apt-get install libnet-ip-perl libgeo-ipfree-perl</tt>. 
-! Configuring Apache 
+! ! Configuring Apache 
-Drop this in /etc/apache2/awstats. conf: 
+Drop this in /etc/apache2/conf.d/awstats
 Alias /awstats-icon/ /usr/share/awstats/icon/ 
 <Directory /usr/share/awstats/icon> 
@@ -15,18 +15,16 @@
  Allow from all 
-Then, add <tt>Include /etc/apache2/awstats.conf</tt> to /etc/apache2/apache2.conf.  
- ! Configuring AWStats 
+! ! Configuring AWStats 
 For each vhost you want to analyse, create a /etc/awstats/ file, looking like such: 
 LogSeparator=" " 
@@ -34,10 +32,70 @@
-To be continued after scones
+Use <tt>~LogFormat 1</tt> if you are using 'combined' Apache logs, which are used by default. Use <tt>~LogFormat 4</tt> otherwise  
+!!Updating the page  
+Some people like to cron a stats update to happen more often. I will be happy with once a day, so I'll use my daily logrotate time. I have a seperate logrotate file for each vhost:  
+/var/www/*.log {  
+ daily  
+ missingok  
+ rotate 7  
+ compress  
+ delaycompress  
+ notifempty  
+ create 640 www-data www-data  
+ prerotate  
+ /usr/lib/cgi-bin/ -update  
+ endscript  
+You could put a cron fragment like this somewhere:  
+3,33 * * * * www-data [ -x /usr/lib/cgi-bin/ -a -f /etc/awstats/ -a -r /var/log/apache/access.log ] && /usr/lib/cgi-bin/ -update >/dev/null  
+!!Password protect your stats  
+We will use Apache's .htaccess mechanism to ensure you can only see the stats if you know a password.  
+<tt>htpasswd -c /etc/awstats/awstats.htpasswd ''username''</tt>  
+Now, edit /etc/apache2/sites-enabled/000-default, under ''<Directory "/usr/lib/cgi-bin">'', add  
+ AuthType basic  
+ AuthName "cgi-bin restricted"  
+ AuthUserFile /etc/awstats/awstats.htpasswd  
+ <Files>  
+ Require valid-user  
+ </Files>  
+Reload Apache, and try navigating to http''''://  
+I am only allowing cgi-bin on my primary host; a good compromise is to set up a redirect from http:''''// to the primary hostname; in /etc/apache2/sites-enabled/  
+ RedirectMatch permanent /stats  
+! !Extra reading  
+* [Debian Administration article|]  
+* [Debian awstats guide|]  
+* [Configuring AWStats and Apache2 on Ubuntu|]