ispCP - Board - Support
[HowTo] AwStats Static Pages UPDATED - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Howtos (/forum-41.html)
+--- Thread: [HowTo] AwStats Static Pages UPDATED (/thread-1372.html)

Pages: 1 2 3 4


[HowTo] AwStats Static Pages UPDATED - grungy - 09-20-2007 08:31 PM

I was so frustrated so last night I wrote this, and it works with trunk 20070919. It is based on SniperSister's tutorial and please test it and post your experience....



THE TUTOR:


Code:
apt-get install awstats

Edit /etc/ispcp/ispcp.conf

Code:
AWSTATS_ACTIVE = yes
AWSTATS_MODE = 1


Check for dmn_custom_b.tpl typo

Code:
ls /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl

if so
Code:
ln -s /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl /etc/ispcp/cron.d/parts/dmn_custom_b.tpl

Code:
ln -s /usr/share/doc/awstats/examples /var/www/ispcp/engine/awstats
mkdir /var/cache/awstats

Code:
ln -s /usr/share/awstats/icon /var/www/awstats/icon

Edit /etc/ispcp/apache/parts/dmn_entry.tpl

after
Code:
Alias /errors   {WWW_DIR}/{DMN_NAME}/errors/

add
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>


Add following to /etc/ispcp/apache/parts/ispcp_base.tpl just before
Code:
#
# Header End
#

Code:
#
# AWStats
#

Alias /awstatsclasses "/var/www/awstats/classes/"
Alias /awstatscss "/var/www/awstats/css/"
Alias /awstatsicons "/var/www/awstats/icon/"
Alias /awstatsjs "/var/www/awstats/js/"
Alias /stats    {WWW_DIR}/{DMN_NAME}/statistics/
<Directory /usr/lib/cgi-bin/awstats>
    AllowOverride AuthConfig
    Options -Includes FollowSymLinks +ExecCGI MultiViews
    AddHandler cgi-script cgi pl
    DirectoryIndex awstats.pl
    Order deny,allow
    Allow from all
</Directory>

this should show up in /etc/apache2/sites-available/ispcp.conf ( I had to add it manually )... and add the same to /etc/ispcp/apache/working/ispcp.conf




open /var/www/ispcp/engine/ispcp-dmn-mngr

Since a directory for each domain needs to be created, we will add some lines under
Code:
#
        # PHP4 and PHP5 Directory for usual user  
        #

Find the part

Code:
$rs = make_dir(
                    "$starter_dir/$dmn_name/php5",
                    $sys_user,
                    $sys_group,
                    0750
                    );

    return $rs if ($rs != 0);
    }


and add some 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 grungy && SniperSister
    #
    # AwStats Directory
    #

    $rs = make_dir(            
                    "$www_dir/$dmn_name/statistics",
                    $sys_user,
                    $sys_group,
                    0755
                    );
    return $rs if ($rs != 0);


UNDER

Code:
################################# DOMAIN DATA ##################################

################################################################################​
##
## Add Domain Data
##


search for

Code:
return $rs if ($rs != 0);

    $rs = dmn_add_mta_data($dmn_data);



and add

Code:
# Modified by grungy && Snipersister for awstats Support
    $rs = dmn_add_bkp_crontab_data($dmn_data);

    return $rs if ($rs != 0);

so it looks like this:

Code:
$rs = dmn_add_mta_data($dmn_data);

    return $rs if ($rs != 0);

# Modified by grungy && Snipersister for awstats Support
    $rs = dmn_add_bkp_crontab_data($dmn_data);

    return $rs if ($rs != 0);

    push_el(\@main::el, 'dmn_add_data()', 'Ending...');

    return 0;
}

Under


Code:
################################################################################​
##
## Delete Domain Data
##


find

Code:
$rs = dmn_del_mta_data($dmn_data);

    return $rs if ($rs != 0);

and add

Code:
# Modified by grungy && Snipersister for awstats Support    
     $rs = dmn_del_crontab_data($dmn_data);

    return $rs if ($rs != 0);

so it looks like this

Code:
$rs = dmn_del_mta_data($dmn_data);

    return $rs if ($rs != 0);
# Modified by grungy && Snipersister for awstats Support
     $rs = dmn_del_crontab_data($dmn_data);

    return $rs if ($rs != 0);
    push_el(\@main::el, 'dmn_del_data()', 'Ending...');

    return 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/cron.d/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/


You can generate the statistics manually by entering the following command to the shell:

Code:
perl /var/www/ispcp/engine/awstats/awstats_buildstaticpages.pl -config=DOMAIN.TLD -update -lang=en -awstatsprog=/usr/lib/cgi-bin/awstats.pl -dir=/var/www/virtual/DOMAIN.TLD/statistics/

just put the domain instead of DOMAIN.TLD



The cron jobs will be put into /etc/cron.d/ispcp


RE: [HowTo] AwStats Static Pages UPDATED - raphael - 09-21-2007 10:46 AM

you need to specify the user under which the cronjob is going to run just after the time info


RE: [HowTo] AwStats Static Pages UPDATED - SniperSister - 09-21-2007 03:23 PM

Hey grungy,
nice to see that somebody else continues the tutorial! I just haven't the time to take a closer look at the current trunk so don't be angry at me - i didn't forget IspCP Wink

Best regards
David


RE: [HowTo] AwStats Static Pages UPDATED - gOOvER - 09-21-2007 04:29 PM

When it works, maybe the Dev's can merge this into the current Trunk Smile


RE: [HowTo] AwStats Static Pages UPDATED - BeNe - 09-21-2007 04:32 PM

Maybe - but this is only Static and not Dynamic.
We will see, should be enough for the first Version in my Eyes.
Better than no AWstats.

Greez BeNe


RE: [HowTo] AwStats Static Pages UPDATED - grungy - 09-21-2007 04:46 PM

This works, tested it on 3 servers.....


RE: [HowTo] AwStats Static Pages UPDATED - BeNe - 09-21-2007 05:17 PM

If i have enough time i will test it on my Demo so the People see AWstats and ispCP in Action Wink

Greez BeNe


RE: [HowTo] AwStats Static Pages UPDATED - Zothos - 09-21-2007 06:29 PM

I have taken a quick look at the howto. This part is fixed in 810. So you dont need it anymore:

Quote:Check for dmn_custom_b.tpl typo

Code:
ls /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl


if so
Code:
ln -s /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl /etc/ispcp/cron.d/parts/dmn_custom_b.tpl[/quote]


RE: [HowTo] AwStats Static Pages UPDATED - grungy - 09-21-2007 06:37 PM

Zothos Wrote:I have taken a quick look at the howto. This part is fixed in 810. So you dont need it anymore:

Quote:Check for dmn_custom_b.tpl typo

Code:
ls /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl


if so
Code:
ln -s /etc/ispcp/cron.d/parts/dmn_cutom_b.tpl /etc/ispcp/cron.d/parts/dmn_custom_b.tpl
[/quote]


I know but for those people who still have older trunks...this typo was present for like 2 months...


RE: [HowTo] AwStats Static Pages UPDATED - BeNe - 09-21-2007 07:14 PM

I tested it in the Demo and it does not Work!
The Status of all domains is change, delete, or toadd but now no Domain is "OK".

What i not understand - what do you mean with this:
Quote:this should show up in /etc/apache2/sites-available/ispcp.conf ( I had to add it manually )...
Must i copy this:
Code:
#
# AWStats
#

Alias /awstatsclasses "/var/www/awstats/classes/"
Alias /awstatscss "/var/www/awstats/css/"
Alias /awstatsicons "/var/www/awstats/icon/"
Alias /awstatsjs "/var/www/awstats/js/"
Alias /stats    {WWW_DIR}/{DMN_NAME}/statistics/
<Directory /usr/lib/cgi-bin/awstats>
    AllowOverride AuthConfig
    Options -Includes FollowSymLinks +ExecCGI MultiViews
    AddHandler cgi-script cgi pl
    DirectoryIndex awstats.pl
    Order deny,allow
    Allow from all
</Directory>
To ALL Domain in the config ? Could this be ?

Greez BeNe