1) Install plugin from
http://www.fusion-ict.nl/da_plugin/awstats.tar.gz
using DA's Plugin Manager.
2) Install latest AWStats version:
/usr/local/directadmin/plugins/awstats/update/update.sh (note, by default it will install 6.5 since the AWStats authors have not "offically" released 6.6, but 6.6 is good idea as it plugs a hole). Since the path of 6.6 is different the 6.5's, do the following:
edit:
/usr/local/directadmin/plugins/awstats/update/update.sh
change:
VER=`cat awstats.ver | egrep -e "http://prdownloads.sourceforge.net/awstats/awstats-(.){3,5}.tar.gz" -o | egrep -e "[0-9]{1,}.[0-9]{1,}" -o`
to:
VER=`cat awstats.ver | egrep -e "http://awstats.sourceforge.net/files/awstats-(.){3,5}.tar.gz" -o | egrep -e "[0-9]{1,}.[0-9]{1,}" -o`
3) Turn off Update from Browser option (previous post's request):
edit:
/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.none.conf
change:
AllowToUpdateStatsFromBrowser=1
to:
AllowToUpdateStatsFromBrowser=0
4) Setup to automatically add access to new accounts:
edit:
/usr/local/directadmin/scripts/custom/user_create_post.sh
insert:
#!/bin/sh
echo $username >> /usr/local/directadmin/plugins/awstats/hooks/permissions.txt
then change the permissions:
chmod a x /usr/local/directadmin/scripts/custom/user_create_post.sh
5) Set up to do daily updates in Crontab:
edit:
/etc/cron.d/directadmin_cron
replace:
10 0 * * * echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue
with:
10 0 * * * root /usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats_updateall.pl now -awstatsprog=/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl && echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue
6) Login to DA Admin panel and click on the AWSTATS plugin link and activate all users you want to it available to.
Done. You could run do the following to do a first update to make sure it's working:
- cd /usr/local/directadmin/plugins/awstats/hooks/cgi-bin/
- perl awstats_updateall.pl now -awstatsprog=/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl
/usr/local/directadmin/plugins/awstats/hooks/cgi-bin# perl awstats_updateall.pl now -awstatsprog=/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl
Running '"/usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl" -update -config=sheepyland.com -configdir="/etc/awstats"' to update config sheepyland.com
Can't locate Time/Local.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl line 16.
BEGIN failed--compilation aborted at /usr/local/directadmin/plugins/awstats/hooks/cgi-bin/awstats.pl line 16.
jjbakker said:Nevermind, just found out how:
awstatsinstall.php:
$cont = ereg_replace("#%DIRDATA%#","/home/{$domainToProcess['user']}/domains/{$domainToProcess['domain']}/stats/",$cont);
awstats.none.conf:
DirData="#%DIRDATA%#"
That way the data is logged on /domain.com/stats
$cont=ereg_replace("#%DIRDATA%#","$basedir/domains/$domains[$awdomain]/stats/",$cont);
$awuser = $_SERVER['USER'];
$awpass = "default";
$auth="
AuthUserFile $location/.htpasswd
AuthType Basic
AuthName \"AwStats Protection\"
<LIMIT GET POST>
require valid-user
</LIMIT>
";
$htpass= "{$awuser}:".crypt($awpass,CRYPT_STD_DES)."\n";
copy ("$dir/cgi-bin/.htaccess","$location/.htaccess");
$fp=fopen("$location/.htaccess","a+");
fwrite($fp,"$auth");
fclose($fp);
$fp=fopen("$location/.htpasswd","w+");
fwrite($fp,$htpass);
fclose($fp);
echo "<br><br>Default password protection set.<br>";
echo "<b>Userid: $awuser<br>";
echo "Password: $awpass</b><br><br>";
echo "It is EXTREMELY recommended that you use the <b><A HREF='awstats/options.php?awdomain=$awdomain'>Tune AwStats</A></b> and m$
tristan said:Thanks for your reaction Sean, I know it's unsupported but maybe there's a way to make it work for a subdomain by hand?
AllowAccessFromWebToAuthenticatedUsersOnly=1
AllowAccessFromWebToFollowingAuthenticatedUsers="#%USER%#"
$cont = ereg_replace("#%USER%#","{$domainToProcess['user']}",$cont);
$cont=ereg_replace("#%USER%#","{$_SERVER['USER']}",$cont);
$fp=fopen("$dir/cgi-bin/awstats.none.conf","r");
$fp2=fopen("/etc/awstats/awstats.$domains[$awdomain].conf","w+");
$cont=fread($fp,filesize("$dir/cgi-bin/awstats.none.conf"));
fclose($fp);
$cont=ereg_replace("#%LOG%#","/var/log/httpd/domains/$domains[$awdomain].log",$cont);
$cont=ereg_replace("#%DOMAIN%#","www.$domains[$awdomain]",$cont);
$cont=ereg_replace("#%USER%#","$awuser",$cont);
$cont=ereg_replace("#%DIRDATA%#","$basedir/domains/$domains[$awdomain]/stats/",$cont);
fwrite($fp2,$cont);
fclose($fp2);