Hi @all,
During the last days I tried to integrate the static pages, which can be generated by awstats. The following HowTo is not finished at all, because the generated stats aren't protected by a passwort or something. I'm currently thinking about howto realize this protection. On top of that, I wasn't able to test it on other distris than
Debian Etch and
ispCP Omega RC2
First of all, install awstats:
Code:
apt-get install awstats
To get static pages, you'll first have to enable Omega's ability to generate awstats configuration files for each domain. Open your ispcp configuration file (should be in /etc/ispcp/) and search the following line:
Replace the "no" with the place where the awstats configuration file should be stored, for example /etc/awstats:
Code:
AWSTATS_DIR = /etc/awstats
When you add a new domain, Omega will generate a awstats-configuration file now. In the next step, we need to create a cronjob for each domain. Omega provides a function to create cronjobs, but this function is disabled at the moment, so we need to enable it. Open /var/www/ispcp/engine/ispcp-dmn-mngr and search for these lines (should be around 3540):
Code:
return $rs if ($rs != 0);
$rs = dmn_add_mta_data($dmn_data);
Below at the following lines:
Code:
# Modified by Snipersister for awstats Support
$rs = dmn_add_crontab_data($dmn_data);
return $rs if ($rs != 0);
Around line 3640 are the following lines:
Code:
$rs = dmn_del_mta_data($dmn_data);
return $rs if ($rs != 0);
Again, add the following code below:
Code:
# Modified by Snipersister for awstats Support
$rs = dmn_del_crontab_data($dmn_data);
return $rs if ($rs != 0);
We need to create a directory for each domain, where the stats can be stored, so lets add some lines behind (should be around 1798)
Code:
$rs = make_dir(
"$starter_dir/$dmn_name/php5",
$sys_user,
$sys_group,
0750
);
return $rs if ($rs != 0);
}
Add the following lines behind this code, so it looks like this:
Code:
$rs = make_dir(
"$starter_dir/$dmn_name/php5",
$sys_user,
$sys_group,
0750
);
return $rs if ($rs != 0);
}
# Added by SniperSister
#
# AwStats Directory
#
$rs = make_dir(
"$www_dir/$dmn_name/statistics",
$sys_user,
$sys_group,
0755
);
return $rs if ($rs != 0);
Okay, now Omega will generate a crontab file for each domain - but with the wrong cronjob! We'll have to change this by editing the template file /etc/ispcp/crontab/parts/dmn_bk_entry.tpl
In the template you'll find a backup cronjob which isn't used anymore. So we'll replace him with our awstats cronjob:
Code:
{MINUTE} {HOUR} * * * 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/
Finally we'll have to edit the apache templates, so each user can view his stats:
At first, edit /etc/ispcp/apache/httpd.conf and remove this line:
Code:
Alias /stats "/usr/lib/cgi-bin/awstats/"
Afterwards, edit /etc/ispcp/apache/parts/ispcp_base.tpl and remove this line again (why doubly?!):
Code:
Alias /stats "/usr/lib/cgi-bin/awstats/"
Now open /etc/ispcp/apache/parts/dmn_entry.tpl and replace
Code:
Redirect /stats http://{DMN_NAME}/awstats/awstats.pl
with
Code:
Alias /stats {WWW_DIR}/{DMN_NAME}/statistics/
Below
Code:
# httpd dmn entry cgi support END.
you'll have to add:
Code:
<Directory "{WWW_DIR}/{DMN_NAME}/statistics">
AllowOverride None
DirectoryIndex awstats.{DMN_NAME}.html
Order allow,deny
Allow from all
</Directory>
The next step is to link the awstats staticpages script into the right directory:
Code:
ln -s /var/www/ispcp/engine/awstats /usr/share/doc/awstats/examples
and copying the icons which are shown:
Code:
mkdir /var/www/awstats
ln -s /var/www/awstats/icon /usr/share/awstats/icon
The last step is to create a database directory for awstats:
Code:
mkdir /var/cache/awstats
Now you're finished! Add a new domain, wait a 24 Hours until the stats have been generated and open them with
http://www.domainname.com/stats/
Best Regards
Snipy