There are two main mechanisms to tell NCSA HTTPd where your scripts are. Each has its pluses and its minuses.
The usual setup is to have the following line in srm.conf:
ScriptAlias /cgi-bin/ cgi-bin/This will make any request to the server which begins with
/cgi-bin/
be fulfilled by executing the corresponding program in
ServerRoot/cgi-bin/
.
You may have more than one ScriptAlias directive in srm.conf to designate different directories as CGI.
The advantages of this setup are ease of administration, centralization, and slight speed advantage. Many system managers don't want things as dangerous as scripts anywhere in the filesystem. The disadvantage is that anyone wishing to create scripts must either have their own entry in srm.conf or must have write access to a ScriptAlias'd directory.
NCSA HTTPd allows you to do this by by specifying a "magic" MIME type for files which tells the server to execute them instead of sending them. To accomplish this, use the AddType directive in either the Server Resource Map or in a per-directory access control file.
For instance, to make all files ending in .cgi scripts, use the following directive:
AddType application/x-httpd-cgi .cgiAlternatively, you could add .sh and .pl after .cgi to allow automatic execution of shell scripts and PERL scripts. Note that you have to have
Options ExecCGI
activated in the directory you create scripts.
The advantage of this setup is that scripts may be absolutely anywhere. The disadvantage is that scripts may be absolutely anywhere (especially places you don't want them to be like users' home directories).