httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] Help needed
Date Fri, 07 Apr 2006 06:33:12 GMT
 

> -----Original Message-----
> From: Marin Angulo, Osvaldo [mailto:osvaldo.marin.angulo@intel.com] 
> Sent: Donnerstag, 6. April 2006 23:03
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] Help needed
> 
> Owen,
> 
> I figured out that if I use "Alias" instead of "ScriptAlias" 
> for the cgi-bin directory that I want to browse, it works (I 
> can browse it), but I lose link to my .cgi files and having 
> "ScriptAlias" for same directory, all my .cgi files work, but 
> directory browsing stops.
> 
> How I can have both options in just one module (Alias or ScriptAlias)?

ScriptAlias and Alias both map an arbitrary directory (not necessarily under the docroot)
onto a URL.
- ScriptAlias tells apache that a directory contains cgi-programs so if a user requests a
file in that dir, apache should try to execute it.
- Alias tells apache that a directory contains plain files so if a user requests a file in
that dir, apache should just send it.

You seem to want to do both: Browse the files (a la Alias) but then execute them by clicking
(a la ScriptAlias). That's impossible using just alias directives.

Whenever you encounter somehting that's impossible, it's usually time to look at mod_rewrite.
This scheme might just work (I haven't tried it):

First of all, use two different aliases to the same dir, eg:

ScriptAlias /cgi /path/to/dir
Alias /dir /path/to/dir

Then if you do http://server/dir/, you will get a listing of /path/to/dir, but if you do http://server/cgi/prog
it will execute /path/to/dir/prog. 

If that works, then you could make a rewrite so that clicking on a filename in the listing,
executes the program, ie:

- suppose you do http://server/dir/ and get a listing.
- then you click on "prog"
- this requests http://server/dir/prog which accesses /path/to/dir/prog as a plain file

If you then have:

	RewriteRule ^/dir/(.*)$ /cgi/$1

that should rewrite the request to http://server/cgi/prog which should do what you want...

I'd be intrigued to learn if this wacky scheme actually works :-)

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 



> 
> Thanks,
> Osvaldo
>   
> 
> -----Original Message-----
> From: Boyle Owen [mailto:Owen.Boyle@swx.com] 
> Sent: Monday, March 27, 2006 12:30 AM
> To: users@httpd.apache.org
> Subject: RE: [users@httpd] Help needed
> 
> > -----Original Message-----
> > From: Marin Angulo, Osvaldo [mailto:osvaldo.marin.angulo@intel.com] 
> > Sent: Freitag, 24. März 2006 18:30
> > To: users@httpd.apache.org
> > Cc: Marin Angulo, Osvaldo
> > Subject: [users@httpd] Help needed
> > 
> > Hi there, 
> > 
> > I was wondering if somebody in this list can help me on 
> > figuring out what is happening with my configuration since 
> > I'm able to link to a .cgi file from my main page, but, if I 
> > try to browse a directory I can't. 
> 
> Do you mean simply that you can't browse a normal filelist of 
> plain files (ie, NOT cgi programs)? If so, look at 
> http://httpd.apache.org/docs/2.2/mod/core.html#options. You need,
> 
> 	Options Indexes
> 
> at least..
> 
> > 
> > I opened permissions, I checked all the FAQs, but I didn't 
> > find anything that clear me what is happening. 
> > 
> > This is the error reported out in the error_log: attempt to 
> > invoke directory as script: /usr/local/apache/cgi-bin and 
> > from the web page, when clicking in the link am getting this one: 
> > 
> > Forbidden 
> > You don't have permission to access ... 
> 
> I suspect you're trying to browse a CGI directory by using 
> its ScriptAlias.. Eg:
> 
> DocumentRoot /usr/local/apache/html
> ScriptAlias /cgi-bin /usr/local/apache/html/subdir/cgi-bin 
> 
> Then if you try to browse http://server/cgi-bin, that won't 
> work.. You need to give the filesystem path relative to the 
> docroot, ie, http://server/subdir/cgi-bin [NB: I moved your 
> CGI-bin to make it clearer - you can't browse it where you 
> have it because it's not under the docroot]
> 
> BTW, even when you browse it, you can't execute the programs 
> by clickking on them - that will only list them.
> 
> Rgds,
> Owen Boyle
> Disclaimer: Any disclaimer attached to this message may be ignored. 
> 
> 
> > 
> > 
> > I really appreciate any help since I am not a specialist on 
> > this matter. 
> > 
> > 
> > Osvaldo 
> > 
> > 
> Diese E-mail ist eine private und persönliche Kommunikation. 
> Sie hat keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der 
> SWX Gruppe. This e-mail is of a private and personal nature. 
> It is not related to the exchange or business activities of 
> the SWX Group. Le présent e-mail est un message privé et 
> personnel, sans rapport avec l'activité boursière du Groupe SWX.
>  
>  
> This message is for the named person's use only. It may 
> contain confidential, proprietary or legally privileged 
> information. No confidentiality or privilege is waived or 
> lost by any mistransmission. If you receive this message in 
> error, please notify the sender urgently and then immediately 
> delete the message and any copies of it from your system. 
> Please also immediately destroy any hardcopies of the 
> message. You must not, directly or indirectly, use, disclose, 
> distribute, print, or copy any part of this message if you 
> are not the intended recipient. The sender's company reserves 
> the right to monitor all e-mail communications through their 
> networks. Any views expressed in this message are those of 
> the individual sender, except where the message states 
> otherwise and the sender is authorised to state them to be 
> the views of the sender's company.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message