File: cgi-ch2.htm

package info (click to toggle)
aolserver 3.4.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 22,692 kB
  • ctags: 33,612
  • sloc: ansic: 171,340; tcl: 10,218; sh: 3,821; cpp: 2,779; makefile: 2,041; yacc: 1,648; perl: 456; php: 13
file content (113 lines) | stat: -rw-r--r-- 4,972 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<HTML><HEAD>
<TITLE>CGI Interface -- Configuring CGI with AOLserver</TITLE>
<LINK rel=Previous href="cgi-ch1.htm">
<LINK rel=ToC href="toc.htm">
<LINK rel=Index href="master.htm">
<LINK rel=Next href="cgi-ch3.htm">
</HEAD><BODY BGCOLOR="#ffffff"><A NAME="topofpage"></A>
<TABLE WIDTH=100%>
  <TR>
    <TD ALIGN=LEFT>
      <A NAME="topofpage"></A> <IMG  SRC="as-c-sm.gif">
    </TD>
    <TD ALIGN=RIGHT>
      <A href="cgi-ch1.htm"><IMG  BORDER="0" src=navbprev.gif alt="[ Previous ]"></A>
      <A href=toc.htm> <IMG  BORDER="0" src=navbhome.gif alt="[ Contents ]"></A>
      <A href=master.htm> <IMG  BORDER="0" src=navbhelp.gif alt="[ Index ]"></A>
      <A href="cgi-ch3.htm"> <IMG  BORDER="0" src=navbnext.gif alt="[ Next ]"></A>
      <A name="7983"> </A>
    </TD>
  </TR>
</TABLE>

<a name="26630">
</a><h3>Configuring CGI with AOLserver</h3>
<p><a name="26635">
</a>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.</p>
<p><a name="26636">
</a>Note that if you're defining multiple servers, you will need to configure the CGI interface for each server.</p>
<a name="26637">
</a><h5>To enable and configure CGI:</h5>
<ol>
<li>Edit your AOLserver configuration file, usually named nsd.tcl.
<a name="26640">
</a><p>
<li>Choose the server for which you want to enable CGI. Add the CGI module to that server. For example:
<a name="26645">
</a><p>
<pre>    <a name="28563"></a>ns_section "ns/server/Server1/modules"
    <a name="28564"></a>ns_param nscgi nscgi.so
</pre><p><li>Add a section for the server called ns/server/<i>server-name</i>/modules/nscgi. For example:
<a name="28556">
</a><p>
<pre>    <a name="28547"></a>ns_section "ns/server/Server1/modules/nscgi"
</pre><p><li>Add CGI mappings for the server to define the method, URL, and directory where the CGI programs reside. For example:
<a name="28535">
</a><p>
<pre>    <a name="28576"></a>ns_section "ns/server/Server1/modules/nscgi"
    <a name="28583"></a>ns_param Map "GET /cgi /usr/local/cgi"
    <a name="28584"></a>ns_param Map "POST /*.cgi"
</pre><p><li>Modify other CGI parameters as needed. See <a href="con-ch3.htm#120876">page 63</a> for descriptions of CGI parameters.
<a name="28574">
</a><p>
<li>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:
<a name="26656">
</a><p>
<ul>
<li>Add a definition for the Interps parameter to your CGI configuration section. For example:<a name="28719">
</a>
<p></ul>
<pre>    <a name="28713"></a>	ns_section "ns/server/Server1/modules/nscgi"
    <a name="28714"></a>	ns_param Map "GET /cgi /usr/local/cgi"
    <a name="28715"></a>	ns_param Map "POST /*.cgi"
    <a name="28718"></a>	ns_param Interps CGIinterps
</pre><p><ul>
<li>Then add an interpreter section containing interpreter definitions. For example:<a name="28711">
</a>
<p></ul>
<pre>    <a name="28763"></a>	ns_section "ns/interps/CGIinterps"
    <a name="28771"></a>	ns_param .pl "c:\perl\bin\perl.exe"
    <a name="28772"></a>	ns_param .sh "c:\mks\mksnt\sh.exe(MKSenv)"
    <a name="28766"></a>
</pre><p><li>If the interpreter requires environment variables, you will need to define an Environment section. Follow these steps:
<a name="28720">
</a><p>
<ul>
<li>Add a definition for the Environment parameter to your CGI configuration section. For example:<a name="28776">
</a>
<p></ul>
<pre>    <a name="28777"></a>	ns_section "ns/server/Server1/modules/nscgi"
    <a name="28778"></a>	ns_param Map "GET /cgi /usr/local/cgi"
    <a name="28779"></a>	ns_param Map "POST /*.cgi"
    <a name="28780"></a>	ns_param Interps CGIinterps
    <a name="28785"></a>	ns_param Environment CGIenvironment
</pre><p><ul>
<li>Then add an environment section containing variable definitions. For example:<a name="28787">
</a>
<p></ul>
<pre>    <a name="28788"></a>	ns_section "ns/interps/CGIenvironment"
    <a name="28789"></a>	ns_param var1 <i>var1-definition
</i>    <a name="28801"></a>	ns_param var2 <i>var2-definition
</i></pre><p></ol>


<TABLE BORDER="2" CELLPADDING="1" width="100%">
<TR><TD COLSPAN=3><P ALIGN=Center>
<IMG SRC="bluebult.gif">
<A HREF="#topofpage">
<FONT SIZE=-1>Top of Page</FONT></A>
<IMG SRC="bluebult.gif">
</TD></TR>
<TR><TD COLSPAN=3><P ALIGN=Center>
<A href="cgi-ch1.htm">
<IMG  BORDER="0" src=navbprev.gif alt="[ Previous ]"></A>
<A href=toc.htm>
<IMG  BORDER="0" src=navbhome.gif alt="[ Contents ]"></A>
<A href=master.htm>
<IMG  BORDER="0" src=navbhelp.gif alt="[ Index ]"></A>
<A href="cgi-ch3.htm">
<IMG  BORDER="0" src=navbnext.gif alt="[ Next ]"></A>
<BR align=center>
<FONT size=-1>Copyright &copy; 1998-99 America Online,
Inc.</FONT>
</TD></TR></TABLE></BODY></HTML>