--
KritsanaMunwong - 06 Feb 2007
#cd /etc/htttpd/conf
#vi httpd.conf
ScriptAlias
The
ScriptAlias? directive tells Apache that a particular directory is set aside for CGI programs. Apache will assume that every file
in this directory is a CGI program, and will attempt to execute it, when that particular resource is requested by a client.
The
ScriptAlias? directive looks like:
ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/
Explicitly using Options to permit CGI execution
You could explicitly use the Options directive, inside your main server configuration file, to specify that CGI execution was permitted in a particular directory:
<.Directory /usr/local/apache/htdocs/somedir.>
Options +ExecCGI
<./Directory.>
.htaccess files
A .htaccess file is a way to set configuration directives on a per-directory basis. When Apache serves a resource, it looks in the directory from which it is serving a file for a file called .htaccess, and, if it finds it, it will apply directives found therein. .htaccess files can be permitted with the
AllowOverride? directive, which specifies what types of directives can appear in these files, or if they are not allowed at all. To permit the directive we will need for this purpose, the following configuration will be needed in your main server configuration:
AllowOverride Options
In the .htaccess file, you'll need the following directive:
Options +ExecCGI
which tells Apache that execution of CGI programs is permitted in this directory.