PDA

View Full Version : Making Stats Accessible to the Public


jlasman
07-07-2004, 09:26 AM
Making Stats Accessible to the Public Mini How-To
Jeff Lasman, directadmin@nobaloney.net 07/07/04 08:26
======================================
Making your Webalizer stats, as maintained by DA, accessible to the public is quite easy under DA as long as you have shell access.

From your public_html directory, create a symbolic link:

stats -> ../stats

Here's how:
ln -s ../stats stats

After that you can look at the stats this way:

http://www.example.com/stats

If you don't have shell access your hosting provider will have to do it for you.

When you contact your hosting provider you should probably point them to this How-To so they see how easy it is :) .

FarCry
07-09-2004, 10:58 AM
or... you could do it with php's exec function :)

jlasman
07-09-2004, 01:37 PM
Originally posted by FarCry
or... you could do it with php's exec function :)
That sounds like a How-To you could write :) .

Jeff

skruf
07-10-2004, 10:59 AM
Hey,

For those not already aware of this, there's some help and how to's here:

http://help.directadmin.com/

The Webalizer how to is there as well:

http://help.directadmin.com/item.php?id=32

David

BigWil
10-20-2004, 09:46 PM
Looks like this is the place to be for Webalizer. Now how can I add a .htaccess to it so that it requires a username/password for access?


Big Wil

jmstacey
10-21-2004, 12:44 AM
You should be able to password protect the stats directory through the filemanager.

BigWil
10-21-2004, 01:10 AM
Nope. I tried that one long before posting. It doesn't give that as an option. The only option is to rename the directory.

stats 0.50k 755 Rename Oct 20 00:30 2004 root root

Big Wil

jlasman
10-21-2004, 07:41 AM
You certainly can add password protection, though you'll have to do it through the shell.

The downside is simple: the password will be required even when entering through the DA interface.

Jeff

Webcart
12-07-2004, 07:13 PM
Just an idea:
create stats dircetory inside public_html and set up mod_rewrite redirect to access ../stats directory.

Since it's not a symbolic link, you can have a password protection in that directory that will not affect stats available via DA.

Webcart
12-07-2004, 07:17 PM
Originally posted by jlasman
You certainly can add password protection, though you'll have to do it through the shell.


Here is a workaround to those who don't like to mess with the shell :

Create a temporary directory under public_html and password protect it. Then move .htaccess file to stats directory outside public_html (with File Manager) and delete the temp directory.

Make sure the name of temporary directory is something you will never use again.

jlasman
12-09-2004, 01:48 PM
Originally posted by Webcart
Just an idea:
create stats dircetory inside public_html and set up mod_rewrite redirect to access ../stats directory.
I believe mod_rewrite works by rewriting the URL in the browser. If it does, then ../stats won't work because the stats directory is outside the webpsace.

Jeff

Webcart
12-10-2004, 01:00 PM
Originally posted by jlasman
I believe mod_rewrite works by rewriting the URL in the browser. If it does, then ../stats won't work because the stats directory is outside the webpsace.

Jeff

That's partially correct: mod rewrite indeed supports external redirects.
However, it also supports internal redirects, which basically map URLs into physical paths on the disk.

Here are some useful links for you:

http://httpd.apache.org/docs/mod/mod_rewrite.html
http://httpd.apache.org/docs/misc/rewriteguide.html

jlasman
12-10-2004, 04:28 PM
I just read both of the references and the only thing I saw would rewrite to the ~username.

That's all I had known of previously to reading them.

However to do this in DA you'd need to use something like:

http:/12.34.56.78/~username/domains/domainname/stats

which I don't think is what most people would want.

Nor would it charge such requests against the user's limits.

If you know of some way to do it that keeps it inside the actual URL of the domain, please let me know; I'd like to learn.

Thanks.

Jeff

Webcart
12-10-2004, 05:43 PM
You can replace ~user with anything you want, that example just demonstrates a way to access a physical location on the disk (/u/user in that example).

The great thing about mod_rewrite is that you can hardcode the absolute path inside mod rewrite rule, you dont have to put any part of it in URL. This is only available within httpd.conf context, though. I think that in .htaccess you are limited to your DocumentRoot directory.

Here is a working example.

[root@~ webcart]#
[root@~ webcart]# cd /home/USER/domains/DOMAIN/public_html/
[root@/home/USER/domains/DOMAIN/public_html webcart]# mkdir demo
[root@/home/USER/domains/DOMAIN/public_html webcart]# cd demo
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]# ln -s /home/USER/domains/DOMAIN/stats stats
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]# echo 'RewriteRule ^demo2/(.*) demo/stats/$1' >> ../.htaccess
[root@/home/USER/domains/DOMAIN/public_html/demo webcart]#


Now, point your browser to http://DOMAIN/demo2/

This set up will obey all rules you put in public_html/demo/.htaccess.
For example, try:

echo "Deny from all" > .htaccess


and refresh the page.

jjma
03-03-2005, 07:33 AM
Having trouble trying to protect the stats directory using the symbolic link method. Can someone point a quick how to.

thanks

Jon

Webcart
03-03-2005, 10:49 AM
Originally posted by jjma
Having trouble trying to protect the stats directory using the symbolic link method. Can someone point a quick how to.

thanks

Jon

The easiest method woudl be to do the following:


cd /home/USERNAME/domains/DOMAINNAME/public_html
mkdir protected_area
cd protected_area
ln -s /home/USERNAME/domains/DOMAINNAME/stats stats


then password protect directory protected_area via DA.
Your stats will be accessible via http://DOMAINNAME/protected_area/stats

Hope that helps.

Webgecko
06-27-2005, 03:15 AM
Another quick way to allow public see your stats is to use an alias in your http.conf file.

Alias /stats /home/USERNAME/domains/DOMAIN/stats/

EXAMPLE:
alias /stats /home/fred/domains/fredsdomain.com/stats/

This way the URL would be:
http://www.fredsdomain.com/stats/

Cheers!