Current time: 05-03-2024, 07:26 PM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] AwStats Static Pages
Author Message
SniperSister Offline
Junior Member
*

Posts: 22
Joined: Feb 2007
Reputation: 0
Post: #1
[HowTo] AwStats Static Pages
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:
Code:
AWSTATS_DIR = no

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
(This post was last modified: 05-24-2007 11:23 PM by SniperSister.)
03-30-2007 06:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BioALIEN Offline
Public Relations Officer
*****
Dev Team

Posts: 620
Joined: Feb 2007
Reputation: 5
Post: #2
RE: [HowTo] AwStats Static Pages
Brilliant, thanks for this how to. I'll be trying it out on Ubuntu Smile
03-30-2007 07:31 PM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #3
RE: [HowTo] AwStats Static Pages
Great HowTo Snipy Wink
Thanks!

I will test it under Debian Etch!
03-31-2007 01:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
SniperSister Offline
Junior Member
*

Posts: 22
Joined: Feb 2007
Reputation: 0
Post: #4
RE: [HowTo] AwStats Static Pages
@Dev-Team
Couldn't this be interesting for the stable release?
04-01-2007 02:42 AM
Visit this user's website Find all posts by this user Quote this message in a reply
xister Offline
Member
*
Beta Team

Posts: 405
Joined: Oct 2006
Reputation: 6
Post: #5
RE: [HowTo] AwStats Static Pages
Have a look at the roadmap:
http://www.isp-control.net/ispcp/query?s....0.0+-+RC2
04-01-2007 03:14 AM
Find all posts by this user Quote this message in a reply
SniperSister Offline
Junior Member
*

Posts: 22
Joined: Feb 2007
Reputation: 0
Post: #6
RE: [HowTo] AwStats Static Pages
xister Wrote:Have a look at the roadmap:
http://www.isp-control.net/ispcp/query?s....0.0+-+RC2

Yeah i know that it's planed to integrate AwStats but as far as i know it's planed to use the perl script to generate the pages on the fly. So i asked wheather the integration of static pages wouldn't be better...
04-01-2007 03:59 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RatS Offline
Project Leader
******

Posts: 1,854
Joined: Oct 2006
Reputation: 17
Post: #7
RE: [HowTo] AwStats Static Pages
why is it better?
04-01-2007 07:51 AM
Visit this user's website Find all posts by this user Quote this message in a reply
SniperSister Offline
Junior Member
*

Posts: 22
Joined: Feb 2007
Reputation: 0
Post: #8
RE: [HowTo] AwStats Static Pages
RatS Wrote:why is it better?

- Each user can only view his own statistics. The perl script makes it possible that you can take a look at the stats of other domains, hosted on this server (using ?config=domainname.tld )
- Security holes in the perl script aren't this dangerous (cause' you can't directly access the script)
- You don't get problems with suexec (which was my problem while trying to get the perl script running on all domains)
04-01-2007 05:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BioALIEN Offline
Public Relations Officer
*****
Dev Team

Posts: 620
Joined: Feb 2007
Reputation: 5
Post: #9
RE: [HowTo] AwStats Static Pages
+1, I know a few ISPs who use statics for this reason also.
04-02-2007 08:29 AM
Find all posts by this user Quote this message in a reply
xyladecor Offline
Junior Member
*

Posts: 15
Joined: Apr 2007
Reputation: 1
Post: #10
RE: [HowTo] AwStats Static Pages
hmmmm.... but: what happens to the statistics of the last month? i can't look at them anymore, right?
next problem: my hoster (no, not a garage-hoster) deactivated it, because it produces a lot of server load to generate the static pages.
(This post was last modified: 04-11-2007 06:37 PM by xyladecor.)
04-11-2007 06:25 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)