httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <>
Subject Re: cgi question
Date Tue, 09 Apr 2002 07:54:36 GMT
Jim Hadfield wrote:
> Having just come from and  NT running to Xitami to TurboLinux running
> Apache, I have a question.
> How do I configure apache to run cgi-bin both in the directory of the
> virtual domain and in the root of the system.  ie,
> which translates to
> var/www/html/something/cgi-bin while still using the default cgi-bin at
> var/www/cgi-bin.  Or, can I just run the cgi-bin in the domain directory
> where it is needed?? ie: var/www/html/something/cgi-bin

You can define CGIs in two ways:

1) File-based:

    AddHandler cgi-script cgi

now any file anywhere which ends in "cgi" will be treated as a CGI
script (i.e. apache will try to execute it, rather than serving it).

2) Directory-based:

   ScriptAlias /cgi-bin /web/cgi-bin

Now any ref to http://servername/cgi-bin/foo will be routed to
/web/cgi-bin/foo and apache will try to execute it. This is true for any
file in /web/cgi-bin, regardless of its extension.

It sounds like you are using method (2). If so, you can have as many
ScriptAlias directives as you like. So you can have:

ScriptAlias /cgi-bin  /var/www/html/something/cgi-bin
ScriptAlias /more-cgi /var/www/cgi-bin


http://servername/cgi-bin/foo  -> /var/www/html/something/cgi-bin/foo
http://servername/more-cgi/bar -> /var/www/cgi-bin/bar

NB: You have to use a different alias for each CGI directory.


Owen Boyle.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message