CGI Interface -- Configuring CGI with AOLserver

### Configuring CGI with AOLserver

You can control the behavior of AOLserver's CGI interface by setting parameters in a configuration file. For example, you can control which files and directories are treated as CGI programs, you can determine how to run various types of programs, and you can set a group of environment variables for each type of program you use.

Note that if you're defining multiple servers, you will need to configure the CGI interface for each server.

##### To enable and configure CGI:

1. Edit your AOLserver configuration file, usually named nsd.tcl.

2. Choose the server for which you want to enable CGI. Add the CGI module to that server. For example:

           ns_section "ns/server/Server1/modules"
           ns_param nscgi nscgi.so

3. Add a section for the server called ns/server/server-name/modules/nscgi. For example:

           ns_section "ns/server/Server1/modules/nscgi"

4. Add CGI mappings for the server to define the method, URL, and directory where the CGI programs reside. For example:

           ns_section "ns/server/Server1/modules/nscgi"
           ns_param Map "GET /cgi /usr/local/cgi"
           ns_param Map "POST /*.cgi"

5. Modify other CGI parameters as needed. See page 63 for descriptions of CGI parameters.

6. If you plan to use a program which requires an interpreter, e.g., Perl or a shell script, you will need to define an Interpreter in the Interps section. Follow these steps:

   - Add a definition for the Interps parameter to your CGI configuration section. For example:

           	ns_section "ns/server/Server1/modules/nscgi"
           	ns_param Map "GET /cgi /usr/local/cgi"
           	ns_param Map "POST /*.cgi"
           	ns_param Interps CGIinterps

   - Then add an interpreter section containing interpreter definitions. For example:

           	ns_section "ns/interps/CGIinterps"
           	ns_param .pl "c:\perl\bin\perl.exe"
           	ns_param .sh "c:\mks\mksnt\sh.exe(MKSenv)"

7. If the interpreter requires environment variables, you will need to define an Environment section. Follow these steps:

   - Add a definition for the Environment parameter to your CGI configuration section. For example:

           	ns_section "ns/server/Server1/modules/nscgi"
           	ns_param Map "GET /cgi /usr/local/cgi"
           	ns_param Map "POST /*.cgi"
           	ns_param Interps CGIinterps
           	ns_param Environment CGIenvironment

   - Then add an environment section containing variable definitions. For example:

           	ns_section "ns/interps/CGIenvironment"
           	ns_param var1 var1-definition
           	ns_param var2 var2-definition

Top of Page
Copyright © 1998-99 America Online, Inc.