[Nottingham] CGI Scripts on Server

Godfrey Nix godfrey at gnnix.co.uk
Wed Aug 2 22:32:34 BST 2006

On Wed, 2006-08-02 at 19:05 +0200, Johan Boshoff wrote:
> Hi all,
> How do I enable cgi scripts on fedora4?  Basically my httpd.conf file points 
> to a location /webserver/cgi-bin, but my websites are stored in 
> /webserver/htdocs/.....  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.

What you need is "ScriptAlias" in the Apache configuration file for
(each ) site. For example, to run scripts in /home/userFred/cgi-bin, you
need to have:
ScriptAlias /cgi-bin/ /home/userFred/cgi-bin/

Now, all references to website.com/cgi-bin/script.pl will run the
program in /home/userFred/cgi-bin/

If this is within a VirtualHost block then it will apply only to that
website. If not inside a VirtualHost block it will apply to ALL sites.

> 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.
Be VERY careful. By allowing users to upload scripts, you allow them to
cause problems - from the simple crash the server (put in an infinite
loop  eg crash.sh = fork xxxxxxxx ! (Please do not try to run,
censored), to the downright [well, WRONG ] extract passwords, install
trojan, etc



Godfrey Nix <godfrey at gnnix.co.uk>

More information about the Nottingham mailing list