Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi All, I have a script located

Status
Not open for further replies.

fortytwo

Technical User
Apr 18, 2000
206
GB
Hi All,

I have a script located in:

/srv/
that I want available to all users, it is basically awstats and it shows different statistics depending on the URL that it is accessed with. To achieve this I have this Directory directive:

<Directory &quot;/srv/ AllowOverride AuthConfig FileInfo Indexes Limit
Options +ExecCGI -Includes -FollowSymLinks -Indexes
Order allow,deny
Allow from all
</Directory>

and this ScriptAlias directive in every VirtualHost container:

ScriptAlias /stats/statistics /srv/
Every virtualhost has a /stats directory where I put the following .htaccess (and associated .htpasswd) file:

AuthUserFile /AuthGroupFile /dev/null
Authname &quot;my.domain.com administration area&quot;
AuthType Basic

<Limit GET>
order deny,allow
allow from all
require user will
</Limit>

The system works fine, when I go to:


I get the stats for my.domain.com and when I go to:


I get the stats for my.other.domain.com and they are accessing the same script at:

/srv/
Unfortunatly the authentication does not work, I have fiddled with the config and it seems to be completely ignoring the .htaccess file. Does anyone have any ideas why this is? I don't want to put a .htaccess file in /srv/ I would rather manage the users access at the virtualhost level. Anyone any ideas about this?

TIA
Will. will@hellacool.co.uk
 
Hi,

I think you put in the wrong folder. Instead of in /stats, why dont you put in /stats/statistics. Make sure you edit your auth section.

regards,
feroz
 
That would mean using the same .htaccess and .htpasswd file for every user which I want to avoid. The /stats directory is in every users account, the /stats/statistics directory is shared between all of the virtualhosts.

Will. will@hellacool.co.uk
 
Hi,

Dont get me wrong. User access folder straight to /stats/statistics, so if you put your .htaccess in /stats it wont work. unless your user access by link in /stats folder.

eg
If you user access straight to it wont works because no .htaccess in this folder.

No harm to use same .htacess and .htpasswd. You can put different user with different password.
 
Hi,

Ignore my previous post. My mistake in use of .htaccess.

regards,
feroz
 
HI,

I think I know what your problem is. Can you make sure in your .htaccess, you specify the coreect path for your password file. It wont work if you put the wrong path.

let me know how you getting on.

regards,
feroz
 
Yep, paths to the .htaccess/.htpasswd files are fine.

I have tried to get the system working with the previous config (see my first post in the thread for details). I am trying a different approach. I have given every virtualhost a statistics directory inside their /stats directory:

will@p15114251:/ cd stats
will@p15114251:/ ls -laR
.:
total 20
drwxr-xr-x 3 will users 4096 2003-03-29 18:36 .
drwxr-xr-x 17 will www 4096 2003-03-27 18:40 ..
-rw-r--r-- 1 will users 285 2003-03-29 18:36 .htaccess
-rw-r--r-- 1 will users 19 2003-03-29 14:10 .htpasswd
drwxr-xr-x 2 will users 4096 2003-03-29 18:42 statistics

./statistics:
total 12
drwxr-xr-x 2 will users 4096 2003-03-29 18:42 .
drwxr-xr-x 3 will users 4096 2003-03-29 18:36 ..
-rw-r--r-- 1 will users 48 2003-03-29 18:42 .htaccess

The .htaccess in the /stats/.htaccess file contains the authentication directives, and the /stats/statistics/.htaccess file contains the line:

DirectoryIndex / /cgi-stats/awstats.pl

and the httpd.conf contains a ScriptAlias for /cgi-stats/. Now I do get asked for the username and password when going to:


but I get a not found when I go to:


I have tried these alternative DirectoryIndex directives:

DirectoryIndex /cgi-stats/awstats.pl
DirectoryIndex awstats.pl /cgi-stats/awstats.pl

but this still does not work when I go to:


Any ideas?

Will. will@hellacool.co.uk
 
HI,

From you error here, sound like apache couldnt find your .pl file. Can you double check your scriptalias line in httpd.conf, please? Can you paste it here if you dont mind. and you dont need .htaccess in /stats/statistics folder. Get rid that file.

If you put &quot;DirectoryIndex awstat.pl&quot;, everytime you go to it will run awstat.pl file. It just a matter of apache find the file or not.

regards,
feroz
 
OK, I don't think you completely understand the problem. Apache finds the script fine if I don't reference it in the URL. If I go to:

or:

it executes the script, but if I go to:

or:

it doesn't. The .htaccess in /stats/statistics folder is necessary because there is no ScriptAlias /stats/statistics/ anymore. Here is the current scriptalias for the /cgi-stats/ directory and the corresponding Directory directive:

ScriptAlias /cgi-stats/ &quot;/srv/<Directory &quot;/srv/ AllowOverride AuthConfig FileInfo Indexes Limit
Options +ExecCGI -Includes -FollowSymLinks -Indexes
Order allow,deny
Allow from all
</Directory>

the .htaccess file in the /stats/statistics/ directory executes the file /cgi-stats/awstats.pl (or should anyway). If I just put:

DirectoryIndex awstat.pl

in that .htaccess file then it will give a 404 because there is no file called 'awstats.pl' in the /stats/statistics/ directory, the 'awstats.pl' file is in the /cgi-stats/ directory, which is accessed from all the virtual hosts.

Will. will@hellacool.co.uk
 
Hi,

I know it didnt work from your first post. Since you have new setting for your scriptalias, why not put both scriptalias and try again. Or use alias instead of scriptalias. First post you said no password asked, but the program was running fine. So put it back just the scriptalias section line and see how it goes from there.

regards,
feroz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top