Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Total AWStats confusion
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sat Nov 20, 2004 3:25 pm    Post subject: Total AWStats confusion Reply with quote

I just emerged AWStats on my webserver, hosting several vhosts. I must say, I'm _very_ confused about the whole AWStats process. I'd like to have awstats working as a CGI, so I can just open www.mydomain.de/stats and I would see my webserver stats for my domain. So far, so good - but how do I do that? I understand I need several conf files in /etc, named awstats.mydomain1.conf, awstats.mydomain2.conf and so forth. Then, I'd have to put awstats.pl into my webserver directory, where the homepage is stored. In my case, this would be /home/mydomain/www/stats/awstats.pl. What I don't know how to do it is: How do I have to config apache so that it executes the .pl script? Also, awstats needs some other files like icons etc, they are all stored somehere in /usr/share ... I believe I could symlink these dirs to my homepage dir, or I could tell awstats somehow where to find these files?

I'd be glad if someone could give me some hints, especially with apache config, I'm a little stuck with that.

Tom
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sat Nov 20, 2004 5:39 pm    Post subject: Re: Total AWStats confusion Reply with quote

elektrohirn wrote:
I just emerged AWStats on my webserver, hosting several vhosts. I must say, I'm _very_ confused about the whole AWStats process. I'd like to have awstats working as a CGI, so I can just open www.mydomain.de/stats and I would see my webserver stats for my domain. So far, so good - but how do I do that? I understand I need several conf files in /etc, named awstats.mydomain1.conf, awstats.mydomain2.conf and so forth. Then, I'd have to put awstats.pl into my webserver directory, where the homepage is stored. In my case, this would be /home/mydomain/www/stats/awstats.pl. What I don't know how to do it is: How do I have to config apache so that it executes the .pl script? Also, awstats needs some other files like icons etc, they are all stored somehere in /usr/share ... I believe I could symlink these dirs to my homepage dir, or I could tell awstats somehow where to find these files?

I'd be glad if someone could give me some hints, especially with apache config, I'm a little stuck with that.

Tom


assuming you have apache2 as your server and you have installed awstats 6.1. add this to /etc/apache2/conf/apache2.conf:
Code:
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/share/webapps/awstats/6.1/htdocs/classes/"
Alias /awstatscss "/usr/share/webapps/awstats/6.1/htdocs/css/"
Alias /awstatsicons "/usr/share/webapps/awstats/6.1/htdocs/icon/"
ScriptAlias /stats/ "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/share/webapps/awstats/6.1/hostroot/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/usr/share/webapps/awstats/6.1/htdocs/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


then create the diffrend awstats.domain1.conf files in /etc/awstats and then restart apache2.

that should do the trick.

if you want to protect the access to awstats, then add something like this to /etc/apache2/conf/apache2.conf:
Code:
<Files "awstats.pl">
    AuthUserFile /usr/share/webapps/awstats/6.1/hostroot/cgi-bin/.htpasswd
    AuthName "Restricted Area For AWStats"
    AuthType Basic
    AuthAuthoritative On
    Require valid-user
    Options +ExecCGI
    DirectoryIndex awstats.pl
</Files>


and then you need to add each user who has access into /usr/share/webapps/awstats/6.1/hostroot/cgi-bin/.htpasswd with the htpasswd2 application.

depending on you setup, maybe you need to change the permission for certain directories:
Code:
chmod 755 /usr/share/webapps/awstats/6.1/htdocs/icon
chmod 755 /usr/share/webapps/awstats/6.1/hostroot/cgi-bin/{lang,lib,plugins}


to get .pl files (perl files) to execute on apache, you need mod_perl (for apache < 2.0). on apache2 this is already included (i think).


cheers

SteveB
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sat Nov 20, 2004 7:44 pm    Post subject: Reply with quote

Wow, thanks a lot, that will definitely help me. Am I right in asuming that those aliases are some kind of symlink-alikes, so when the awstats.pl tries to load something from the directory /awstatsclasses then Apache2 would redirect it to /usr/share/web..." ?? And ScriptAlias means when a user accesses www.mydomain.de/stats Apache would redirect this request to /usr/share/... where the script is located right? That would be a perfect setup, I'll check it out! Thanks again!

Tom
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sat Nov 20, 2004 8:04 pm    Post subject: Reply with quote

Hello,

I just tried it and it works perfectly! Thank you again for that. I'll read trough the config to fully understand it for myself. There's one little problem tough, the bars in the statistics should be colored, but awstats.pl seems to not find the images that are used to color the bars, so all bars are just white. How's that?

Tom
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sat Nov 20, 2004 8:07 pm    Post subject: Reply with quote

elektrohirn wrote:
Hello,

I just tried it and it works perfectly! Thank you again for that. I'll read trough the config to fully understand it for myself. There's one little problem tough, the bars in the statistics should be colored, but awstats.pl seems to not find the images that are used to color the bars, so all bars are just white. How's that?

Tom
no. it does not find the icons. check again for the icons configuration (or maybe you need to force a refresh of your browser).

cheers / Gruss

Steve
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sat Nov 20, 2004 8:13 pm    Post subject: Reply with quote

Hmm I'll look where the icons are stored and check the link. Ok one last question. How do I teach apache that when I enter www.mydomain.de/stats that it should load the awstats.pl? In commonapache2.conf, there's a section

Code:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.php index.shtml index.cgi index.pl index.htm awstats.pl
</IfModule>


I thought I could just add awstats.pl there, but it didn't work out. May a symlink or so work?
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sat Nov 20, 2004 8:34 pm    Post subject: Reply with quote

maybe a script alias or a rewrite rule would do the trick?

cheers

steve
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sun Nov 21, 2004 1:36 pm    Post subject: Reply with quote

I'm afraid I need some further assistance. I tried everything imaginable, but I didn't manage to config Apache in a way that I could just enter "www.mydomain.de/stats" in a browser to open my statisitcis - I always have to explicitely add "/awstats.pl". I tried everything from linking index.pl -> awstats.pl, changing the ScriptAlias, directly linking /stats to awstats.pl and so forth, but it just didn't work out. Can somebody help me out please?

Tom
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sun Nov 21, 2004 4:23 pm    Post subject: Reply with quote

elektrohirn wrote:
I'm afraid I need some further assistance. I tried everything imaginable, but I didn't manage to config Apache in a way that I could just enter "www.mydomain.de/stats" in a browser to open my statisitcis - I always have to explicitely add "/awstats.pl". I tried everything from linking index.pl -> awstats.pl, changing the ScriptAlias, directly linking /stats to awstats.pl and so forth, but it just didn't work out. Can somebody help me out please?

Tom
There you go. The first alias needed is:
Code:
ScriptAlias /stats "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/awstats.pl"
This adds /stats as an alias to the awstats.pl script.

the next needed alias is:
Code:
ScriptAlias /awstats.pl "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/awstats.pl"
this is needed, because awstats will look for /awstats.pl and without the alias it would not display any statistics.

complete addition to /etc/apache2/conf/apache2.conf:
Code:
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/usr/share/webapps/awstats/6.1/htdocs/classes/"
Alias /awstatscss "/usr/share/webapps/awstats/6.1/htdocs/css/"
Alias /awstatsicons "/usr/share/webapps/awstats/6.1/htdocs/icon/"
ScriptAlias /awstats/ "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/"
ScriptAlias /stats "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/awstats.pl"
ScriptAlias /awstats.pl "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/awstats.pl"

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/share/webapps/awstats/6.1/hostroot/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/usr/share/webapps/awstats/6.1/htdocs/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/usr/share/webapps/awstats/6.1/hostroot/cgi-bin/">
    Options +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>



this will work for what you wanted, but will not allow you to use http://www.mydomain.de/stats?conf=www.another-domain.de syntax. you would then still need to use http://www.mydomain.de/awstats/awstats.pl?conf=www.another-domain.de if you want to open another statistics. or you could write an rewrite rule.


cheers

SteveB
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sun Nov 21, 2004 5:33 pm    Post subject: Reply with quote

Hello, thank you very much for that. Indeed I tried both ScriptAlias for myself, but never got the idea to put them both together :-) I'll reconfig Apache then, thanks again!

Tom
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sun Nov 21, 2004 6:19 pm    Post subject: Reply with quote

let us know if this is working for you.

cheers

SteveB
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sun Nov 21, 2004 6:31 pm    Post subject: Reply with quote

Yes, it works perfectly now! Thank you very much! Would never have worked that out without your help I guess.

Tom
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sun Nov 21, 2004 7:42 pm    Post subject: Reply with quote

elektrohirn wrote:
Yes, it works perfectly now! Thank you very much! Would never have worked that out without your help I guess.

Tom
Locker ;)

Gruss

Steve
Back to top
View user's profile Send private message
fs_mariner
n00b
n00b


Joined: 12 Jun 2004
Posts: 45

PostPosted: Tue Dec 21, 2004 10:38 pm    Post subject: Excellent Reply with quote

Excellent, your very thourough and you helped me a lot. Thanks.
Quote:
Alias /awstatsicons "/usr/share/webapps/awstats/6.1/htdocs/icon/"

Needs to be:

Alias /awstatsicon "/usr/share/webapps/awstats/6.1/htdocs/icon/"

For the icons to show up... just an "s" on awstatsicons needs to be removed.

Thanks again!
_________________
Earth wanderer on the beautiful sailing vessels "spiritwind", "friendship", and "wavesofgrace"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum