apache with cgi

Mike Bilow mikebw at colossus.bilow.com
Fri Apr 28 09:24:32 EDT 2000


On Thu, 20 Apr 2000, Lars Kellogg-Stedman wrote:

> With that out of the way...
> 
> A default apache installation goes in /usr/local/apache, and everything
> from this point down assumes that location.  If you've got apache installed
> elsewhere, substitute accordingly.

The modern interpretation is that anything in the "local" tree is not
under package management.  If you are running any distribution which has
package management, which is pretty much every Linux system around now,
then you will find Apache as a package and it will be somewhere other than
in the "local" tree.  Debian, which probably has the most sophisticated
Apache installation in a package, will put the configuration files under
/etc/apache, the default document root under /var/www, the ScriptAlias
path in /usr/lib/cgi-bin, and the log files in /var/log/apache.

> A stock apache install defines /usr/local/apache/cgi-bin as your cgi
> directory.  Anything executable in this directory can be access via the URL
> <http://your.server.edu/cgi-bin/script>.
> 
> The relevant configuration directives look something like this:
> 
>   ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
>   <Directory "/usr/local/apache/cgi-bin">
>       AllowOverride None
>       Options None
>       Order allow,deny
>       Allow from all
>   </Directory>

This is all really a holdover from the base NCSA web server.  Modern
Apache has several different technique for identifying scripts.  The
"ScriptAlias" directive, among other things, tells Apache to regard
anything in that directory as a script, regardless of its filename.  Any
directory with scripts in it should always be set "Options -Indexes" to
prevent someone from getting the names of the scripts in the directory.

If you do not use a ScriptAlias, then you can actually put CGI scripts
anywhere if you use "Options +ExecCGI" there.  (Of course, "Options
-Indexes +ExecCGI" would be the recommended directive.)  In this case,
Apache recognizes scripts by the filename suffix, by default ".cgi" (this
is controlled by an "AddHandler cgi-script .cgi" directive).  Note that
a suffix of ".pl" does not mean "Perl" by default -- it means the document
is in Polish; you have to change this if you want it changed.

-- Mike


-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list