Home > Archive > PERL CGI Beginners > September 2004 > DirectoryIndex
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Octavian Rasnita 2004-09-12, 8:55 pm |
| Hello all,
I have named index.html a file that in fact is a perl cgi program and I have
put it in the directory /cgi-bin/
It works fine if I access it using an URL like:
http://localhost/cgi-bin/index.html
The problem is that I want to access that program using:
http://localhost/cgi-bin/
But it gives me the 403 Access denied error.
I have put Options FollowSymLinks MultiViews Includes ExecCGI indexes for
that directory but it still doesn't choose automaticly the file index.html
from that directory.
I have tested but it doesn't choose even if I use another extension (like
..cgi) and if I set it to be a DirectoryIndex in httpd.conf.
Do you know if a certain file (like index.html) can be automaticly chosen by
the web server if rezides in a ScriptAlias directory (like /cgi-bin/)?
Or, are there any other secure solutions for what I want to do?
Thank you.
Teddy
| |
| Hcohen2 2004-09-12, 8:55 pm |
| Octavian Rasnita wrote:
>Hello all,
>
>I have named index.html a file that in fact is a perl cgi program and I have
>put it in the directory /cgi-bin/
>
>It works fine if I access it using an URL like:
>
>http://localhost/cgi-bin/index.html
>
>The problem is that I want to access that program using:
>
>http://localhost/cgi-bin/
>
>But it gives me the 403 Access denied error.
>
>I have put Options FollowSymLinks MultiViews Includes ExecCGI indexes for
>that directory but it still doesn't choose automaticly the file index.html
>from that directory.
>
>I have tested but it doesn't choose even if I use another extension (like
>.cgi) and if I set it to be a DirectoryIndex in httpd.conf.
>Do you know if a certain file (like index.html) can be automaticly chosen by
>the web server if rezides in a ScriptAlias directory (like /cgi-bin/)?
>
>Or, are there any other secure solutions for what I want to do?
>
>Thank you.
>
>Teddy
>
>
>
>
Ted,
Find your httpd.conf file, mine was located in /usr/local/apache/conf -
on a Linux build.
Then search on ScriptAlias - the first hit on my file was line number
566 that begins the comments on this 'feature'. In the default file my
scripts were placed in the directory:
/usr/local/apache/cgi-bin
I left the code unaltered and just placed my scripts in that directory.
I made the files executable for all classes of users, which I am not
certain is necessary. By default all files in this directory are
executed when requested rather than sent upon receiving a request (see
comments in this file).
HTH
If this does NOT work, then I have another suggestion, but I tend to
doubt that you are as inventive as I in finding ways to screwup a system
as I am. I did it by mistakenly altering this same file and a mismatch
on the profile running my browser! Now that takes <i><b>talent</i>!</b>
| |
| Chris Devers 2004-09-14, 3:55 am |
| On Sun, 12 Sep 2004, Octavian Rasnita wrote:
> I have named index.html a file that in fact is a perl cgi program and I have
> put it in the directory /cgi-bin/
>
> It works fine if I access it using an URL like:
>
> http://localhost/cgi-bin/index.html
>
> The problem is that I want to access that program using:
>
> http://localhost/cgi-bin/
>
> But it gives me the 403 Access denied error.
Right -- I don't know that that's possible.
If you're okay with having scripts execute from any directory based on
file extension, then you can do something like this:
* for the directory you want scripts to execute in, find the right
"<Directory ...>" section, and in that the "Options ..." line. Add
ExecCGI to this line. (In a typical httpd.conf, the first Directory
line is for the base of your filesystem, and has very restrictive
access; the second Directory directive is the base of your web
document tree -- adding ExecCGI here is probably what you want.)
* Find the DirectoryIndex line(s), and add a new extension for your CGI
scripts: "DirectoryIndex index.html index.pl index.cgi" etc
Make these changes, then test & re-start Apache:
$ sudo apachectl configtest && sudo apachectl restart
Then try putting a CGI script in your regular document tree -- not the
one that is used for cgi-bin, the one with all your html, images, etc --
and see if it executes the same way it did in the cgi-bin directory. if
so, then try setting the name to index.pl, and see if you urls such as
http;//yoursite/project/index.pl
and
http;//yoursite/project/
end up being the same thing. They should be, but test it.
--
Chris Devers
|
|
|
|
|