[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Cron for AWStats



Hello

I found th FAQ again written by Dj-GrOove .. please enjoy

Demo: http://awstats.sourceforge.net/demo/awstats.demo.html

Step by step installation AWSTATS 4.XX 

First, uninstall webalizer if you have this ugly stat installed. If you want, you can run webalizer and awstats at the same time, but i no recomend that, belivme, you can overload your server. 

Log as root ------------------------------------------------------------- 
[root@www /root]#cd /home 
[root@www /home]# wget http://awstats.sourceforge.net/files/awstats.tgz 
[root@www /home]# tar -xvizf awstats.tgz 
[root@www /home]# chown -R root.root awstats-4.0 
[root@www /home]# mv awstats-4.0 awstats 

Next move dirs to suite personal preferences and delete some 
misc. files: 
-------------------------------------------------------------- 
[root@www /home]# cd awstats 
[root@www awstats]# rm *.TXT 
[root@www awstats]# mv /home/awstats/wwwroot/cgi-bin/* /home/awstats/ 
[root@www awstats]# mv /home/awstats/wwwroot/icon /home/awstats/icon 
[root@www awstats]# rm -R wwwroot 

Change owners and permissions for security and to make it work: 
--------------------------------------------------------------- 
[root@www awstats]# chmod 750 awstats.pl 
[root@www awstats]# chmod -R 644 icon 
[root@www awstats]# chmod -R 644 lang 
[root@www awstats]# ll
 

Write one .htaccess file for grant access only to site-admins : ) 
---------------------------------------------------------------- 
Authname Awstats 
Authtype Basic 
require group site-adm 
order allow,deny 
allow from all 

And change owners and permissions: 
---------------------------------- 
[root@www awstats]# chmod 640 .htaccess 
[root@www awstats]# chown root.httpd .htaccess 

Create one common conf file 
Copying the model.conf and make changes: 
---------------------------------------------------------------------- 
--- 
[root@www awstats]# cp awstats.model.conf awstats.conf 

(I list here only the conf options needed to work, the rest as you prefered) 
------------------------------------------------------------------- 
pico awstats.conf 

change this list values: 

LogFile="/home/sites/__SERVER_NAME__/logs/web.log" 
DirData="/home/sites/__SERVER_NAME__/logs" 
DirCgi="/awstats-cgi" 
DirIcons="/awstats-img" 
DirLang="./lang" 
AllowAccessFromWebToAuthenticatedUsersOnly=1 
PurgeLogFile=1 

I make changes to apache conf files for make it work: 
----------------------------------------------------- 
[root@www awstats]# cd /etc/httpd/conf 
pico httpd.conf 

Search in httpd.conf the section of rewrite rules and add at end 
of section another rule for awstats: 


$rewrite_rules = 
'RewriteEngine On 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteCond %{DOCUMENT_ROOT} !-d 
RewriteRule .* proto://servername:81/.cobalt/error/forbidden.html [L,R] 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/admin/?$ proto://servername:81/.cobalt/sysManage/index.html [L,R] 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/siteadmin/?$ proto://servername:81/.cobalt/siteManage/%1/index.html [$ 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/personal/?$ proto://servername:81/.cobalt/personal/index.html [L,R] 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/.cobalt/(.+) proto://servername:81/.cobalt/$1 [L,R] 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/cgi-bin/.cobalt/(.+) proto://servername:81/cgi-bin/.cobalt/$1 [L,R] 
RewriteCond %{HTTP_HOST} ^([^:]+) 
RewriteRule ^/stats/?$ http://servername/awstats-cgi/awstats.pl?config=servername [L,R] 
'; 


Next, at the end of this perl section (</Perl>) I add one external 
include file: 
---------------------------------------------------------------------- 
---------- 
. 
. 
} 
</Perl> 

# AWSTATS - Include Control file - 
include /etc/httpd/conf/awstats.conf 

Next I write this AWSTATS - Include Control file and save it as 
awstats.conf 
in the /etc/httpd/conf dir: 

pico awstats.conf 

add that: 

# icons and images dirs alias 
Alias /awstats-img/ /home/awstats/icon/ 
# cgi-bin dir alias 
Alias /awstats-cgi/ /home/awstats/ 
# awstats dir options 
<Directory /home/awstats> 
# allow .htaccess files 
AllowOverride All 
# the dir is a cgi-bin 
Options ExecCGI 
# perl scripts 
AddHandler cgi-script .pl 
</Directory> 

save awstats.conf 

---------------------------------------------------------------------- 

Update stats daily: 

Change the permissions on logs directories: 

pico /home/awstats/awstats.sh : 

cd /home/sites 
for a in home site* ; do 
chmod 777 /home/sites/$a/logs 
done 

for a in home site* ; do 
export SERVER_NAME=$a 
/home/awstats/awstats.pl config=site 
done 

-cut- 

chmod 755 /home/awstats/awstats.sh 

At the bottom of /etc/cron.daily/logrotate add this: 

/home/awstats/awstats.sh 


------------------------------------------------------ 



Remember to restart apache: 

[root@www conf]# /etc/rc.d/init.d/httpd restart 

For new sites, add the necessary lines to /etc/logrotate.conf 


eNJOy THiS wONDERfULL sTtaTS ! :) 

Thanks to Martin Moeller for support all time, i think he can write pkg installation for awstats , but i think you can install with mi instructions :) 
Thanks to AWSTATS developers. 


Dj-GrOove ICQ: 30363689 



Note: Last minute addition: To check site stats write: 
www.sitename.com/stats 

Also, I have changed a rather long list of sites to a for-loop for clarity and brevity. Hopefully it doesn't take anything away from the meaning of the article.