efectoguido
Posts: 2
Joined: Feb 2012
Reputation: 0
|
RE: Enable awstats after installation.
Hi, these are the steps for solving the issue:
1) change the ispcp.conf, the section of the AWSTATS to look like this
-----------------------------
# # AWSTATS data #
AWSTATS_ACTIVE = yes
# could be 'dynamic' = 0 or 'static' = 1
AWSTATS_MODE = 1
AWSTATS_CACHE_DIR = /var/cache/awstats
AWSTATS_CONFIG_DIR = /etc/awstats
AWSTATS_ENGINE_DIR = /usr/lib/cgi-bin
AWSTATS_WEB_DIR = /usr/share/awstats
AWSTATS_ROOT_DIR = /var/www/ispcp/engine/awstats
AWSTATS_GROUP_AUTH = statistics
------------------------
note: AWSTAT_MODE must be 1, to be static
2) Then enable mod_proxy in the apache configuration
3) ceate the file 01_awstats.conf in sites enabled, into the apache sites-enabled dir:
---------------------
bash$ cat>/etc/apache2/sites-enabled/01_awstats.conf
#
# AWStats Begin
#
Alias /awstatsicons "/usr/share/awstats/icon/"
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/stats/(.+)/$ http://localhost/awstats/?config=$1 [P]
RewriteRule ^/stats/(.+)/awstats.pl(.*)$ http://localhost/awstats/$1 [P]
RewriteRule ^/stats/(.*)$ http://localhost/stats/$1/ [R]
</IfModule>
ScriptAlias /awstats "/usr/lib/cgi-bin/awstats.pl"
<Directory /usr/lib/cgi-bin>
AllowOverride none
Options +ExecCGI
DirectoryIndex awstats.pl
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
#
# AWStats End
#
-----------------------
4) install awstats and verify that the paths of the ispcp.conf exists:
all these paths exists?
/var/cache/awstats
/etc/awstats
/usr/lib/cgi-bin
/var/www/ispcp/engine/awstats
5) create a new site, and then go to the newsite.com/stats
usual problems:
If the awstats says that there is a problem with browsers.pm, maybe the problem is that you have 2 awstats installed, so you must chek what awstats works and replace it in the corresponding path (ispcp.con)
6) What about old sites? to make the awstats works on old sites, you must delete it and create again... or you can generate the conf files (manual way)
--------manual way, supose borrar7.com.ar is the new site with statics we use is as model ----
#path /etc/awstats/
for i in $(ls /var/www/virtual/ | grep -v borrar7.com); do cat awstats.borrar7.com.ar.conf | sed -e "s/borrar7.com.ar/$i/g" >awstats.$i.conf; done
-------------------------------
-and then add this to the /etc/apache2/ispcp/oldsite.conf , suppose oldsite.com.ar is the site that was created without the awstats installed.
---------------------- save this as /tmp/modelo
# httpd awstats support BEGIN.
Alias /awstatsicons "/usr/share/awstats/icon/"
Alias /stats "/var/www/virtual/oldsite.com.ar/statistics/"
<Directory "/var/www/virtual/oldsite.com.ar/statistics">
#AllowOverride AuthConfig
DirectoryIndex awstats.oldsite.com.ar.html
Order allow,deny
Allow from all
</Directory>
#I donnt know rigth now if the autentication works, so i will comment it
# <Location /stats>
#AuthType Basic
#AuthName "Statistics for domain oldsite.com.ar"
#AuthUserFile /var/www/virtual/oldsite.com.ar/.htpasswd
#AuthGroupFile /var/www/virtual/oldsite.com.ar/.htgroup
#Require group statistics
# </Location>
# httpd awstats support END.
#To create all the apache conf files
# in /etc/apache2/ispcp/
#
#for i in $(ls); do cat /tmp/modelo | sed -e "s/oldsite.com.ar/$i/g" >$i.conf; done
#
--------------------------
6b) Also you must add the statistics folder to the domain
---------- cmd line for create the statics with the correct username group and mode
bash# /var/www/virtual# for i in $(ls -la | awk {'print $3","$9'}); do own=$(echo $i| awk -F, {'print $1'});domain=$(echo $i| awk -F, {'print $2'});mkdir $domain/statistics ; chown $own $domain/statistics; chgrp $own $domain/statistics ;chmod 755 $domain/statistics; done
-----------
7) Generate all the static pages of awstats for each domain
----------command lina to generate all the stats
for DMN_NAME in $(ls /var/www/virtual/); do perl /var/www/ispcp/engine/awstats/awstats_buildstaticpages.pl -config=$DMN_NAME -update -lang=en -awstatsprog=/usr/lib/cgi-bin/awstats.pl -dir=/var/www/virtual/$DMN_NAME/statistics/ ; done
---------------
Reinventing the wheel??
Cheers,
(This post was last modified: 02-07-2012 05:03 AM by efectoguido.)
|
|
02-07-2012 02:51 AM |
|