[Nottingham] CGI Scripts on Server

Johannes Kling jok at printk.net
Thu Aug 3 00:27:59 BST 2006


Hello,

> How do I enable cgi scripts on fedora4?
IIRC, Fedora usese apache2. IT's really not Fedora specific, so a good
read of the relevant docs at http://httpd.apache.org/ will help you
alot  :).

> Basically my httpd.conf file points to a location
> /webserver/cgi-bin, but my websites are stored in
> /webserver/htdocs/.....

You'll have to be more specific about what "points" means. Is one the
DocumentRoot and the other the ScriptAlias, or do you use plain Alias,
or Redirect or any of the plethora of other ways of "pointing" URLs at
a certain location? You best bet is probably to quote the relevant
bits from your httpd.conf (anonymize any sensitive bits, if you're
paranoid). 

> How do I link to that cgi-bin folder when I want to run a script
> like formmail.pl on a website that generates a form.  I tried
> pointing the cgi-bin folder to the main domain so that I can try to
> link to example www.test.com/cgi-bin/formmail.pl, but it does not
> work.

The normal way is to have DocumentRoot point at the "static" web root
and then have a ScriptAlias pointing at the cgi-bin directory for each
of your sites in the relevant VirtualHost section.. You could also use
a <Directory> stanza if you want a more generic solution, e.g.:

<Directory "/home/sites/*/web/cgi-bin/">
     AllowOverride None
     Options ExecCGI
     Order allow,deny
     Allow from all
</Directory>

The above would allow users to create a cgi-bin directory in their
DocumentRoot (which must much /home/sites/*/web/) and use it as
expected. Note that it goes against the common advice of having CGI
scripts outside of the DocumentRoot, however.

> I want to have a cgi-bin directory for each domain on my server so that 
> users can upload and link to their own scripts.

You really don't /want/ that, even if you might have to ;-).

Give us a bit more detail about what is in place at the moment and how
exactly you expect it to work, and answering your question will become
a lot easier.

Regards,
 Jo

-- 
Terrorists may attack the open society, but only governments can abolish it.



More information about the Nottingham mailing list