AWstats from static to dynamic

j.lambers

New member
Joined
Jul 8, 2008
Messages
3
Hi all,

I have just installed a new server with DA 1.322 with AWstats included. This install uses AWstats with static pages, this does not look very nice. All our other server use AWstats plugin with dynamic pages. Our customers are used to the dynamic version.

Question 1:
Is there a way to configure the DA AWstats install to dynamic?

Question 2:
Is there a way to migratie these awstats from AWstats plugin 3.02 to this DA Awstats implemented version?

Regards,
Jelle
 
Edit /usr/local/directadmin/scripts/awstats_process.sh for your own needs :)
 
Hi Martynas,

I am trying to understand what's in the file, but i am not quit there yet :rolleyes:
Do you know what i should change to get the same look as with the dynamic version?

For the stats migration i am testing something now.
 
Edit /usr/local/directadmin/scripts/awstats_process.sh for your own needs :)

could you clarify? I had a look at the awstats_process.sh script also, and tried numerous things to try and get the frames and "Update Now" links to work in AWStats, but no luck
 
Sorry to bump a month old thread but for anyone else looking to do this, here are some tweaks I made to mine to have it work.

First, go to /usr/local/directadmin/scripts and run ./awstats.sh to install awstats onto the server.

Second, browse to /usr/local/awstats/wwwroot/cgi-bin and make a file called .htaccess and put
Code:
Options +ExecCGI
AddHandler cgi-script pl
DirectoryIndex awstats.pl
into the file.

Third, make a backup of the original awstats.pl and then open it and find the line (searching for etc lets you jump to this line in 2-3 searches):
Code:
 else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }
and replace it with
Code:
 else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats","../../awstats/.data"); }
        $SiteConfig =~ s/^www\.//;

Fourth, go to /usr/local/directadmin/scripts/custom and download the modified shell file (feel free to look through it all to make sure it isn't doing anything harmful, there are too many code changes made throughout the script to list them all out here)
Code:
cd /usr/local/directadmin/scripts/custom
wget http://www.pejoo.net/awstats_process.sh
chmod 0700 awstats_process.sh
chown diradmin:diradmin awstats_process.sh

Note that this will turn on GeoIP (which requires the perl-Geo-IP package as well as the GeoIP database) and full DNS Lookup for AWStats, if you do not want this find the lines
Code:
        perl -pi -e "s#DNSLookup=2#DNSLookup=1#" ${CONFIG}
        perl -pi -e "s#\#LoadPlugin=\"geoip GEOIP_STANDARD /pathto/GeoIP.dat\"#LoadPlugin=\"geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat\"#" ${CONFIG}
and remove them.

That should make AWStats run dynamically on your server and, if you are using the awstats plugin already, just copy all your current .txt data files into the /home/user/domain/awstats/.data directory and it will read all of your old monthly stats.

To view the stats, just go to http://www.domain.com/awstats and it will all be there. The script can probably be adjusted to make it even more robust but this is all I needed it to do so I do not plan to modify it any further, though if you want to then by all means go for it.
 
Sorry to bump a month old thread but for anyone else looking to do this, here are some tweaks I made to mine to have it work.

First, go to /usr/local/directadmin/scripts and run ./awstats.sh to install awstats onto the server.

Second, browse to /usr/local/awstats/wwwroot/cgi-bin and make a file called .htaccess and put
Code:
Options +ExecCGI
AddHandler cgi-script pl
DirectoryIndex awstats.pl
into the file.

Third, make a backup of the original awstats.pl and then open it and find the line (searching for etc lets you jump to this line in 2-3 searches):
Code:
 else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }
and replace it with
Code:
 else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats","../../awstats/.data"); }
        $SiteConfig =~ s/^www\.//;

Fourth, go to /usr/local/directadmin/scripts/custom and download the modified shell file (feel free to look through it all to make sure it isn't doing anything harmful, there are too many code changes made throughout the script to list them all out here)
Code:
cd /usr/local/directadmin/scripts/custom
wget http://www.pejoo.net/awstats_process.sh
chmod 0700 awstats_process.sh
chown diradmin:diradmin awstats_process.sh

Note that this will turn on GeoIP (which requires the perl-Geo-IP package as well as the GeoIP database) and full DNS Lookup for AWStats, if you do not want this find the lines
Code:
        perl -pi -e "s#DNSLookup=2#DNSLookup=1#" ${CONFIG}
        perl -pi -e "s#\#LoadPlugin=\"geoip GEOIP_STANDARD /pathto/GeoIP.dat\"#LoadPlugin=\"geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat\"#" ${CONFIG}
and remove them.

That should make AWStats run dynamically on your server and, if you are using the awstats plugin already, just copy all your current .txt data files into the /home/user/domain/awstats/.data directory and it will read all of your old monthly stats.

To view the stats, just go to http://www.domain.com/awstats and it will all be there. The script can probably be adjusted to make it even more robust but this is all I needed it to do so I do not plan to modify it any further, though if you want to then by all means go for it.

Did anyone try this and is this safe?
 
first, awstats.pl cannot be found. i assume its /usr/local/awstats/wwwroot/cgi-bin/awstats.pl


2nd, else { @PossibleConfigDir=("$DIR","/etc/awstats","/usr/local/etc/awstats","/etc","/etc/opt/awstats"); }

this code cnanot be found.
 
so the directadmin custombuild install of AwStats is not really useful, as it gives us some stripped off version of AwStats?

great >.>
 
Thanks Marshall. This is great.

But, jeff, is it so hard to become a default for directadmin? It seems so easy.
 
I don't know why DirectAdmin made the default what they did. As I mentioned in a previous thread today, I'm NOT an employee of DirectAdmin and I have no more control over what they include in DirectAdmin than anyone else who posts here.

Jeff
 
protect directory awstats

Is it possible to protect automaticly the awstats create in public_html with .htaccess using user name and password (the username and password to login at control panel) of each domain ?

EDIT: I find how i must do :) Thanks for your tuto.
 
Last edited:
I post the change I made in awstats_process.sh to create a protect dir automaticly, perhaps someone are interesting ;)

in /usr/local/awstats/wwwroot/cgi-bin/.htaccess I add this:
Code:
AuthGroupFile /dev/null
AuthName "awstats"
AuthType basic
AuthUserFile /home/USER/domains/DOMAIN/.htpasswd/public_html/awstats/.htpasswd
require valid-user
after:
Code:
Options +ExecCGI
AddHandler cgi-script pl
DirectoryIndex awstats.pl

in /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf I modify this:
AllowAccessFromWebToAuthenticatedUsersOnly=0
by:
AllowAccessFromWebToAuthenticatedUsersOnly=1

in /usr/local/directadmin/scripts/custom/awstats_process.sh downloaded from http://www.pejoo.net/, I modify this:
Code:
perl -pi -e "s#LogFile=\"/var/log/httpd/mylog.log\"#LogFile=\"${LOG}\"#" ${CONFIG}
        perl -pi -e "s#SiteDomain=\"\"#SiteDomain=\"${DOMAIN}\"#" ${CONFIG}
        perl -pi -e "s#DirData=\".\"#DirData=\"${DATA_DIR}\"#" ${CONFIG}
        perl -pi -e "s#DirCgi=\"/cgi-bin\"#DirCgi=\/awstats\"#" ${CONFIG}
        perl -pi -e "s#DirIcons=\"/icon\"#DirIcons=\"icon\"#" ${CONFIG}
        perl -pi -e "s#ValidHTTPCodes=\"200 304\"#ValidHTTPCodes=\"200 304 206\"#" ${CONFIG}
        perl -pi -e "s#DNSLookup=2#DNSLookup=1#" ${CONFIG}
        perl -pi -e "s#\#LoadPlugin=\"geoip GEOIP_STANDARD /pathto/GeoIP.dat\"#LoadPlugin=\"geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat\"#" ${CONFIG}

        mkdir -p ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/icon ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/lib ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/lang ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/plugins ${WEBDIR}
        cp -fp ${AWSTATS}/wwwroot/cgi-bin/awstats.pl ${WEBDIR}
        cp -fp ${AWSTATS}/wwwroot/cgi-bin/.htaccess ${WEBDIR}
        
        chown -R ${USER}:${USER} ${WEBDIR}
        chown -R root:${ROOTGRP} ${STATS_DIR}
by this:
Code:
perl -pi -e "s#LogFile=\"/var/log/httpd/mylog.log\"#LogFile=\"${LOG}\"#" ${CONFIG}
        perl -pi -e "s#SiteDomain=\"\"#SiteDomain=\"${DOMAIN}\"#" ${CONFIG}
        perl -pi -e "s#AllowAccessFromWebToFollowingAuthenticatedUsers=\"\"#AllowAccessFromWebToFollowingAuthenticatedUsers=\"${USER}\"#" ${CONFIG}
        perl -pi -e "s#DirData=\".\"#DirData=\"${DATA_DIR}\"#" ${CONFIG}
        perl -pi -e "s#DirCgi=\"/cgi-bin\"#DirCgi=\/awstats\"#" ${CONFIG}
        perl -pi -e "s#DirIcons=\"/icon\"#DirIcons=\"icon\"#" ${CONFIG}
        perl -pi -e "s#ValidHTTPCodes=\"200 304\"#ValidHTTPCodes=\"200 304 206\"#" ${CONFIG}
        perl -pi -e "s#DNSLookup=2#DNSLookup=1#" ${CONFIG}
        perl -pi -e "s#\#LoadPlugin=\"geoip GEOIP_STANDARD /pathto/GeoIP.dat\"#LoadPlugin=\"geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat\"#" ${CONFIG}

        mkdir -p ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/icon ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/lib ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/lang ${WEBDIR}
        cp -Rp ${AWSTATS}/wwwroot/cgi-bin/plugins ${WEBDIR}
        cp -fp ${AWSTATS}/wwwroot/cgi-bin/awstats.pl ${WEBDIR}
        cp -fp ${AWSTATS}/wwwroot/cgi-bin/.htaccess ${WEBDIR}

        perl -pi -e "s#AuthUserFile /home/USER/domains/DOMAIN/.htpasswd/public_html/awstats/.htpasswd#AuthUserFile ${UHOME}/domains/${DOMAIN}/.htpasswd/public_html/awstats/.htpasswd#" ${WEBDIR}/.htaccess
        mkdir -p ${UHOME}/domains/${DOMAIN}/.htpasswd/public_html/awstats
        cat /etc/shadow | grep ${USER} > ${UHOME}/domains/${DOMAIN}/.htpasswd/public_html/awstats/.htpasswd
        echo -e "/domains/${DOMAIN}/public_html/awstats" >> ${UHOME}/domains/${DOMAIN}/.htpasswd/.protected.list

        chown -R ${USER}:${USER} ${UHOME}/domains/${DOMAIN}/.htpasswd/public_html
        chown -R ${USER}:${USER} ${WEBDIR}
        chown -R root:${ROOTGRP} ${STATS_DIR}

Can you tell me if it is secure? :)
 
This looks interesting... I might have to try this out...Has anyone tried to skin awstats at all?
 
I tried this and it doesn't seem to restore the old functionality of awstats. Am I missing something?

Keefe
 
I don't know why DirectAdmin made the default what they did. As I mentioned in a previous thread today, I'm NOT an employee of DirectAdmin and I have no more control over what they include in DirectAdmin than anyone else who posts here.

Jeff

Well when people read your signature fast it looks likei you are "DirectAdmin Administration" I know this is now how you have written it, but that's what pops out.... so unless you like to be looked at in this manner and have people suggesting these things, you might want to re-word it... lol
 
It seems pretty clear to me. But I've changed the word Contract to the phrase Third-Party. Perhaps now it'll be more clear.

Note that I am one of the forum administrators, but I serve at JBMC's pleasure (JBMC is the name of the company developing/distributing DirectAdmin).

Jeff
 
While we're on the same topic, is it also possible to enable "Manual Updating" as default seeing that there's no real time reporting with the current implementation of Awstats.
 
hey all.

i know this is an old thread, but im wondering if anyone made this work?. ive tried the above suggested solutions but they dont work.

Can anyone suggest or have a working solution to switching from the standard awstats module to using the dynamic version.

thanks
brendan
 
Back
Top