5918986fe0aaa74659b86cac731918136beb81d2
[mod_fastcgi.git] / docs / mod_fastcgi.html
blob5918986fe0aaa74659b86cac731918136beb81d2
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <!-- $Id: mod_fastcgi.html,v 1.34 2002/10/04 04:37:48 robs Exp $ -->
4 <HEAD>
5 <TITLE>
6 Apache module mod_fastcgi
7 </TITLE>
8 <STYLE TYPE="text/css">
9 body {
10 background-color: #ffffff;
11 color: #000000;
13 :link { color: #0000ff }
14 :visited { color: #000080 }
15 :active { color: #ff0000 }
16 h3.c3 {text-align: center}
17 h1.c2 {text-align: center}
18 p.c1 {text-align: center}
19 </STYLE>
20 </HEAD>
21 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
22 <BODY>
23 <P CLASS="c1">
24 <IMG SRC="http://httpd.apache.org/docs/images/sub.gif" ALT="[APACHE FEATHER BANNER]" WIDTH="500" HEIGHT=
25 "62">
26 </P>
27 <H1 CLASS="c2">
28 Module mod_fastcgi
29 </H1>
30 <P>
31 This 3<SUP>rd</SUP> party module provides support for the FastCGI protocol. FastCGI is a language
32 independent, scalable, open extension to CGI that provides high performance and persistence without the
33 limitations of server specific APIs.
34 </P>
35 <P>
36 FastCGI applications are not limited to a particular development language (the protocol is open). FastCGI
37 application libraries currently exist for Perl, C/C++, Java, Python, TCL, SmallEiffel, and Smalltalk.
38 </P>
39 <P>
40 FastCGI applications use TCP or Unix sockets to communicate with the web server. This scalable architecture
41 allows applications to run on the same platform as the web server or on many machines scattered across an
42 enterprise network.
43 </P>
44 <P>
45 FastCGI applications are portable to other web server platforms. FastCGI is supported either directly or
46 through commercial extensions by most popular web servers.
47 </P>
48 <P>
49 FastCGI applications are fast because they&#39;re persistent. There is no per-request startup and
50 initialization overhead. This makes possible the development of applications which would otherwise be
51 impractical within the CGI paradigm (e.g. a huge Perl script, or an application which requires a connection
52 to one or more databases).
53 </P>
54 <P>
55 See the FastCGI <A HREF="http://www.FastCGI.com/">website</A> for more information. To receive FastCGI
56 related announcements and notifications of software updates, subscribe to <A HREF=
57 "http://fastcgi.com/fastcgi-announce">fastcgi-announce</A>. To participate in the discussion of
58 <CODE>mod_fastcgi</CODE> and FastCGI application development, subscribe to <A HREF=
59 "http://fastcgi.com/fastcgi-developers">fastcgi-developers</A>.
60 </P>
61 <H2>
62 Summary
63 </H2>
64 <P>
65 For information about building and installing the module, see the <A HREF="../INSTALL">INSTALL</A> document
66 that came with the distribution.
67 </P>
68 <P>
69 FastCGI applications under <CODE>mod_fastcgi</CODE> are defined as one of three types: static, dynamic, or
70 external. They&#39;re configured using the <A HREF="#fastcgiserver">FastCgiServer</A>, <A HREF=
71 "#FastCgiConfig">FastCgiConfig</A>, and <A HREF="#FastCgiExternalServer">FastCgiExternalServer</A> <A HREF=
72 "#directives">directives</A> respectively. Any URI that Apache identifies as a FastCGI application and
73 which hasn&#39;t been explicitly configured using a <A HREF="#fastcgiserver">FastCgiServer</A> or <A HREF=
74 "#FastCgiExternalServer">FastCgiExternalServer</A> directive is handled as a dynamic application (see the
75 <A HREF="#FastCgiConfig">FastCgiConfig</A> directive for more information).
76 </P>
77 <P>
78 FastCGI static and dynamic applications are spawned and managed by the FastCGI Process Manager, fcgi-pm.
79 The process manager is spawned by Apache at server initialization. External applications are presumed to be
80 started and managed independently.
81 </P>
82 <P>
83 Apache must be configured to identify requests for FastCGI URIs. <CODE>mod_fastcgi</CODE> registers (with
84 Apache) a handler type of <CODE>fastcgi-script</CODE> for this purpose.
85 </P>
86 <P>
87 To configure Apache to handle all files (within the scope of the directive) as FastCGI applications (e.g.
88 for a fcgi-bin directory):
89 </P>
90 <BLOCKQUOTE>
91 <P>
92 <CODE><A HREF="http://httpd.apache.org/docs/mod/mod_mime.html#sethandler">SetHandler</A>
93 fastcgi-script</CODE>
94 </P>
95 </BLOCKQUOTE>
96 <P>
97 To configure Apache to handle files (within the scope of the directive) with the specified extension(s) as
98 FastCGI applications:
99 </P>
100 <BLOCKQUOTE>
102 <CODE><A HREF="http://httpd.apache.org/docs/mod/mod_mime.html#addhandler">AddHandler</A> fastcgi-script
103 fcg fcgi fpl</CODE>
104 </P>
105 </BLOCKQUOTE>
107 Consult the Apache documentation for more information regarding these and other directives which affect
108 request handling (such as <CODE><A HREF=
109 "http://httpd.apache.org/docs/mod/mod_actions.html#action">Action</A>).</CODE>
110 </P>
112 Dynamic FastCGI applications require the <CODE>ExecCGI</CODE> option be enabled (see the <A HREF=
113 "http://httpd.apache.org/docs/mod/core.html#options"><CODE>Options</CODE></A> directive) in the
114 application&#39;s directory.
115 </P>
116 <H2>
117 Notes
118 </H2>
120 <CODE>mod_fastcgi</CODE> logs FastCGI application error (stderr) output to the server log associated with
121 the request. Errors reported by the FastCGI process manager, fcgi-pm, are reported to the main server log
122 (typically, logs/error_log). Data written to stdout or stderr before entering the FastCGI <EM>accept</EM>
123 loop or via a mechanism that is not FastCGI protocol aware will also be directed to the main server log. If
124 Apache&#39;s <A HREF="http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A> is set
125 to <CODE>info</CODE> additional informational messages are printed to the logs, these messages may be
126 especially helpful while debugging a configuration.
127 </P>
129 Under Unix, expect your FastCGI application to see SIGPIPE, SIGUSR1, and SIGTERM. The latest FastCGI C, C++
130 and Perl application library installs default handlers if none are installed by the application. If an http
131 client aborts a request before it completes, mod_fastcgi does too - this results in a SIGPIPE to the
132 FastCGI application. At a minimum, SIGPIPE should be ignored (applications spawned by mod_fastcgi have this
133 setup automatically). Ideally, it should result in an early abort of the request handling within your
134 application and a return to the top of the FastCGI accept() loop. Apache uses SIGUSR1 to request a
135 &quot;graceful&quot; process restart/shutdown. It is sent to Apache&#39;s process group (which includes
136 applications spawned by mod_fastcgi). Ideally, it should result in a FastCGI application finishing the
137 current request, if any, and then an exit. The mod_fastcgi process manager isn&#39;t particularly patient
138 though (there&#39;s room for improvement here) and since it has to shutdown too, sends a SIGTERM to all of
139 the FastCGI applications it is responsible for. Apache will restart the process manager and it will restart
140 its managed applications (as if the server was just started). SIGTERM is, well, SIGTERM - your application
141 should exit quickly.
142 </P>
144 Under Windows, there are no signals. A shutdown event is used instead. This is setup by mod_fastcgi and
145 honored by the latest version of the C, C++, and Perl application library. If your using a library which
146 doesn&#39;t support this, your application will not get shutdown during an Apache restart/shutdown
147 (there&#39;s room for improvement here).
148 </P>
150 To pass per-request environment variables to FastCGI applications, have a look at: <A HREF=
151 "http://httpd.apache.org/docs/mod/mod_env.html"><CODE>mod_env</CODE></A> (<CODE>SetEnv</CODE>,
152 <CODE>PassEnv</CODE>, <CODE>UnSetEnv</CODE>), <A HREF=
153 "http://httpd.apache.org/docs/mod/mod_setenvif.html"><CODE>mod_setenvif</CODE></A>
154 (<CODE>BrowserMatch</CODE>, <CODE>BrowserMatchNoCase</CODE>, <CODE>SetEnvIf</CODE>,
155 <CODE>SetEnvIfNoCase</CODE>), and <A HREF=
156 "http://httpd.apache.org/docs/mod/mod_rewrite.html"><CODE>mod_rewrite</CODE></A> (if you&#39;re feeling
157 adventurous).
158 </P>
160 FastCGI application output is buffered by default. This is not the case for CGI scripts (under Apache 1.3).
161 To override the default behavior, use the <CODE>-flush</CODE> option (not available for dynamic
162 applications). Non-parsed header (nph-) scripts will be rejected by mod_fastcgi simply as warning the
163 behavior is different (create a symbolic link to the script without the &quot;nph-&quot; prefix if this
164 poses a problem).
165 </P>
167 Redirects are handled similarly to CGI. Location headers with values that begin with &quot;/&quot; are
168 treated as internal-redirects; otherwise, they are treated as external redirects (302).
169 </P>
171 Session affinity (as well as distribution) should be achievable outside of <CODE>mod_fastcgi</CODE> using
172 <A HREF="http://httpd.apache.org/docs/mod/mod_rewrite.html"><CODE>mod_rewrite</CODE></A>. If you get this
173 working, please post the details to <A HREF=
174 "mailto:fastcgi-developers@fastcgi.com">fastcgi-developers@fastcgi.com</A> so they can be included here.
175 </P>
176 <H2>
177 FastCGI Specification Compliance
178 </H2>
180 The FastCGI specification is not implemented in its entirety and I&#39;ve deviated a bit as well resulting
181 in some Apache specific features.
182 </P>
184 The file descriptors for stdout and stderr are left open. This is prohibited by the specification. I
185 can&#39;t see any reason to require that they be closed, and leaving them open prevents FastCGI
186 applications which were not completely ported to FastCGI from failing miserably. This does not mean the
187 applications shouldn&#39;t be fixed such that this doesn&#39;t occur, but is invaluable when using a
188 3<SUP>rd</SUP> party library (without source code) which expects to be able to write to stderr. Anything
189 written to stdout or stderr in this manner will be directed to the main server log.
190 </P>
192 The Filter and Log Roles are not supported. The Filter Role has little value in Apache until the output of
193 one handler can be piped into another (Apache 2.0 is expected to support this). The Log Role has some
194 value, but Apache&#39;s &quot;piped logs&quot; feature is similar (and is even more CPU friendly).
195 </P>
197 The FastCGI protocol supports a feature, described in the specificiation as &quot;multiplexing&quot;, that
198 allows a single client-server connection to be simultaneously shared by multiple requests. This is not
199 supported. This does *not* prevent FastCGI applications from supporting multiple simultaneous requests over
200 independent connections. Of course, the application has to be specifically designed to do so by using a
201 threaded or select/poll based server model.
202 </P>
204 The Authorizer Role has three variations corresponding to three specific Apache request handling
205 phases:&nbsp; Authentication, Authorization, and Access Control. <CODE>mod_fastcgi</CODE> sets up the
206 (Apache specific) environment variable &quot;FCGI_APACHE_ROLE&quot; to indicate which Apache authorizer
207 phase is being performed.
208 </P>
210 Authorizers under <CODE>mod_fastcgi</CODE> are sent nearly all of the standard environment variables
211 typically available to CGI/FastCGI request handlers including some explicitly precluded by the FastCGI
212 specification (for authorizers); I didn&#39;t see the point in leaving them out. All headers returned by a
213 FastCGI Authorizer in a successful response (Status: 200) are passed to sub-processes (CGI/FastCGI
214 invocations) as environment variables rather than just those prefixed by <CODE>Variable-</CODE> as the
215 FastCGI specification calls for; I didn&#39;t see the point in leaving them out either. FastCGI
216 specification compliant authorizer behavior can be obtained by using the <CODE>-compat</CODE> option to the
217 Auth server directives.
218 </P>
220 Custom failure responses from FastCGI authorizer applications are not supported (speak up if you need
221 this). See the <A HREF="http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A>
222 directive for a workaround (a CGI/FastCGI application can serve the error document).
223 </P>
224 <H2>
225 <A NAME="directives">Directives</A>
226 </H2>
227 <UL>
228 <LI>
229 <A HREF="#FastCgiServer"><CODE>FastCgiServer</CODE></A>
230 </LI>
231 <LI>
232 <A HREF="#FastCgiConfig"><CODE>FastCgiConfig</CODE></A>
233 </LI>
234 <LI>
235 <A HREF="#FastCgiExternalServer"><CODE>FastCgiExternalServer</CODE></A>
236 </LI>
237 <LI>
238 <A HREF="#FastCgiIpcDir"><CODE>FastCgiIpcDir</CODE></A>
239 </LI>
240 <LI>
241 <A HREF="#FastCgiWrapper"><CODE>FastCgiWrapper</CODE></A>
242 </LI>
243 <LI>
244 <A HREF="#FastCgiAuthenticator"><CODE>FastCgiAuthenticator</CODE></A>
245 </LI>
246 <LI>
247 <A HREF="#FastCgiAuthenticatorAuthoritative"><CODE>FastCgiAuthenticatorAuthoritative</CODE></A>
248 </LI>
249 <LI>
250 <A HREF="#FastCgiAuthorizer"><CODE>FastCgiAuthorizer</CODE></A>
251 </LI>
252 <LI>
253 <A HREF="#FastCgiAuthorizerAuthoritative"><CODE>FastCgiAuthorizerAuthoritative</CODE></A>
254 </LI>
255 <LI>
256 <A HREF="#FastCgiAccessChecker"><CODE>FastCgiAccessChecker</CODE></A>
257 </LI>
258 <LI>
259 <A HREF="#FastCgiAccessCheckerAuthoritative"><CODE>FastCgiAccessCheckerAuthoritative</CODE></A>
260 </LI>
261 </UL>
262 <HR>
263 <H2>
264 <A NAME="FastCgiServer">FastCgiServer</A>
265 </H2>
266 <!-- %plaintext &lt;?INDEX {\tt FastCgiServer} directive&gt; -->
267 <TABLE BORDER="0" SUMMARY="">
268 <TR>
269 <TD>
270 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
271 "Help"><STRONG>Syntax:</STRONG></A>
272 </TD>
273 <TD>
274 <CODE>FastCgiServer <EM>filename</EM> <EM>[option ...]</EM></CODE>
275 </TD>
276 </TR>
277 <TR>
278 <TD>
279 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
280 "Help"><STRONG>Context:</STRONG></A>
281 </TD>
282 <TD>
283 server config
284 </TD>
285 </TR>
286 </TABLE>
288 The <CODE>FastCgiServer</CODE> directive defines <EM>filename</EM> as a static FastCGI application. If the
289 filename does not begin with a slash (/) then it is assumed to be relative to the <A HREF=
290 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
291 </P>
293 By default, the Process Manager will start one instance of the application with the default configuration
294 specified (in parentheses) below. Should a static application instance die for any reason
295 <CODE>mod_fastcgi</CODE> will spawn another to replace it and log the event (at the <CODE>warn</CODE> <A
296 HREF="http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>).
297 </P>
299 <EM>Option</EM> can be one of (case insensitive):
300 </P>
301 <DL>
302 <DT>
303 <CODE><STRONG>-appConnTimeout <EM>n</EM></STRONG> (0 seconds)</CODE>
304 </DT>
305 <DD>
306 <STRONG>Unix:&nbsp;</STRONG> The number of seconds to wait for a connection to the FastCGI application
307 to complete or 0 to indicate a blocking <CODE>connect()</CODE> should be used. Blocking
308 <CODE>connect()</CODE>s have an OS dependent internal timeout<CODE>.</CODE> If the timeout expires, a
309 SERVER_ERROR results. For non-zero values, this is the amount of time used in a <CODE>select()</CODE>
310 to write to the file descriptor returned by a non-blocking <CODE>connect().</CODE> Non-blocking
311 <CODE>connect()</CODE>s are troublesome on many platforms. See also <CODE>-idle-timeout</CODE>, it
312 produces similar results but in a more portable manner.<BR>
313 <STRONG>Windows NT:&nbsp;</STRONG> TCP based applications work as above. Named pipe based applications
314 (static applications configured without the <CODE>-port</CODE> option and dynamic applications) use
315 this value successfully to limit the amount of time to wait for a connection (i.e. it&#39;s not
316 &quot;troublesome&quot;). By default, this is 90 seconds (FCGI_NAMED_PIPE_CONNECT_TIMEOUT in
317 mod_fastcgi.h).
318 </DD>
319 <DT>
320 <CODE><STRONG>-group <EM>groupname|#gid</EM></STRONG> (none)</CODE>
321 </DT>
322 <DD>
323 <STRONG>Unix (only):</STRONG> When <A HREF="#FastCgiWrapper">FastCgiWrapper</A> is in use, the group is
324 used to invoke the wrapper. The <CODE>-group</CODE> option must be used together with
325 <CODE>-user</CODE>.
326 </DD>
327 <DT>
328 <CODE><STRONG>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
329 </DT>
330 <DD>
331 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
332 event is logged (at the <CODE>error</CODE> <A HREF=
333 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
334 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
335 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
336 the request will be aborted. If communication is complete with the application but incomplete with the
337 client (the response is buffered), the timeout does not apply.
338 </DD>
339 <DT>
340 <CODE><STRONG>-initial-env <EM>name[=[value]]</EM></STRONG> (none)</CODE>
341 </DT>
342 <DD>
343 A name-value pair to be passed in the FastCGI application&#39;s <EM>initial</EM> environment. To pass a
344 variable from Apache&#39;s environment, don&#39;t provide the &quot;=&quot; (if the variable isn&#39;t
345 actually in the environment, it will be defined without a value). To define a variable without a value,
346 provide the &quot;=&quot; without any value. The option can be used repeatedly.
347 </DD>
348 <DT>
349 <CODE><STRONG>-init-start-delay <EM>n</EM></STRONG> (1 second)</CODE>
350 </DT>
351 <DD>
352 The minimum number of seconds between the spawning of instances of this application. This delay
353 decreases the demand placed on the system at server initialization.
354 </DD>
355 <DT>
356 <CODE><STRONG>-flush</STRONG> (none)</CODE>
357 </DT>
358 <DD>
359 Force a write to the client as data is received from the application. By default,
360 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
361 </DD>
362 <DT>
363 <CODE><STRONG>-listen-queue-depth <EM>n</EM></STRONG> (100)</CODE>
364 </DT>
365 <DD>
366 The depth of <CODE>listen()</CODE> queue (also known as the backlog) shared by all of the instances of
367 this application. A deeper listen queue allows the server to cope with transient load fluctuations
368 without rejecting requests; it does not increase throughput. Adding additional application instances
369 may increase throughput/performance, depending upon the application and the host.
370 </DD>
371 <DT>
372 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
373 </DT>
374 <DD>
375 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
376 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
377 environment.
378 </DD>
379 <DT>
380 <CODE><STRONG>-port <EM>n</EM></STRONG> (none)</CODE>
381 </DT>
382 <DD>
383 The TCP port number (1-65535) the application will use for communication with the web server. This
384 option makes the application accessible from other machines on the network (as well as this one). The
385 <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually exclusive.
386 </DD>
387 <DT>
388 <CODE><STRONG>-priority <EM>n</EM></STRONG> (0)</CODE>
389 </DT>
390 <DD>
391 The process priority to be assigned to the application instances (using <CODE>setpriority()</CODE>).
392 </DD>
393 <DT>
394 <CODE><STRONG>-processes <EM>n</EM></STRONG> (1)</CODE>
395 </DT>
396 <DD>
397 The number of instances of the application to spawn at server initialization.
398 </DD>
399 <DT>
400 <CODE><STRONG>-restart-delay <EM>n</EM></STRONG> (5 seconds)</CODE>
401 </DT>
402 <DD>
403 The minimum number of seconds between the respawning of failed instances of this application. This
404 delay prevents a broken application from soaking up too much of the system.
405 </DD>
406 <DT>
407 <CODE><STRONG>-socket <EM>filename</EM></STRONG> (generated)</CODE>
408 </DT>
409 <DD>
410 <STRONG>Unix:&nbsp;</STRONG> The filename of the Unix domain socket that the application will use for
411 communication with the web server. The module creates the socket within the directory specified by
412 <CODE><A HREF="#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. This option makes the application accessible
413 to other applications (e.g. <CODE>cgi-fcgi</CODE>) on the same machine or via an external FastCGI
414 application definition (<CODE><A HREF="#FastCgiExternalServer">FastCgiExternalServer</A></CODE>). If
415 neither the <CODE>-socket</CODE> nor the <CODE>-port</CODE> options are given, the module generates a
416 Unix domain socket filename. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually
417 exclusive.
418 </DD>
419 <DD>
420 <STRONG>Windows NT:&nbsp;</STRONG> The name of the named pipe that the application will use for
421 communication with the web server. The module creates the named pipe under the named pipe root
422 specified by <CODE><A HREF="#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. This option makes the application
423 accessible to other applications (e.g. <CODE>cgi-fcgi</CODE>) on the same machine or via an external
424 FastCGI application definition (<CODE><A HREF=
425 "#FastCgiExternalServer">FastCgiExternalServer</A></CODE>). If neither the <CODE>-socket</CODE> nor the
426 <CODE>-port</CODE> options are given, the module generates a name for the named pipe. The
427 <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually exclusive.
428 </DD>
429 <DT>
430 <CODE><STRONG>-user <EM>username|#uid</EM></STRONG> (none)</CODE>
431 </DT>
432 <DD>
433 <STRONG>Unix (only):</STRONG> When <A HREF="#FastCgiWrapper">FastCgiWrapper</A> is in use, the user is
434 used to invoke the wrapper. The <CODE>-user</CODE> option must be used together with
435 <CODE>-group</CODE>.
436 </DD>
437 </DL>
438 <HR>
439 <H2>
440 <A NAME="FastCgiConfig">FastCgiConfig</A>
441 </H2>
442 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
443 <TABLE BORDER="0" SUMMARY="">
444 <TR>
445 <TD>
446 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
447 "Help"><STRONG>Syntax:</STRONG></A>
448 </TD>
449 <TD>
450 <CODE>FastCgiConfig <EM>option [option ...]</EM></CODE>
451 </TD>
452 </TR>
453 <TR>
454 <TD>
455 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
456 "Help"><STRONG>Context:</STRONG></A>
457 </TD>
458 <TD>
459 server config
460 </TD>
461 </TR>
462 </TABLE>
464 The <CODE>FastCgiConfig</CODE> directive defines the default parameters for <EM>all</EM> dynamic FastCGI
465 applications. This directive does not affect static or external applications in any way.
466 </P>
468 Dynamic applications are not started at server initialization, but upon demand. If the demand is heavy,
469 additional application instances are started. As the demand fades, application instances are killed off.
470 Many of the options govern this process.
471 </P>
473 <EM>Option</EM> can be one of (case insensitive):
474 </P>
475 <DL>
476 <DT>
477 <CODE><STRONG>-appConnTimeout <EM>n</EM></STRONG> (0 seconds)</CODE>
478 </DT>
479 <DD>
480 <STRONG>Unix:&nbsp;</STRONG> The number of seconds to wait for a connection to the FastCGI application
481 to complete or 0 to indicate a blocking <CODE>connect()</CODE> should be used. Blocking
482 <CODE>connect()</CODE>s have an OS dependent internal timeout. If the timeout expires, a SERVER_ERROR
483 results. For non-zero values, this is the amount of time used in a <CODE>select()</CODE> to write to
484 the file descriptor returned by a non-blocking <CODE>connect()</CODE>. Non-blocking
485 <CODE>connect()</CODE>s are troublesome on many platforms. See also <CODE>-idle-timeout</CODE>, it
486 produces similar results but in a more portable manner.<BR>
487 <STRONG>Windows NT:&nbsp;</STRONG> TCP based applications work as above. Named pipe based applications
488 (static applications configured without the <CODE>-port</CODE> option and dynamic applications) use
489 this value successfully to limit the amount of time to wait for a connection (i.e. it&#39;s not
490 &quot;troublesome&quot;). By default, this is 90 seconds (FCGI_NAMED_PIPE_CONNECT_TIMEOUT in
491 mod_fastcgi.h).
492 </DD>
493 <DT>
494 <CODE><STRONG>-autoUpdate</STRONG> (none)</CODE>
495 </DT>
496 <DD>
497 Causes mod_fastcgi to check the modification time of the application on disk before processing each
498 request. If the application on disk has been changed, the process manager is notified and all running
499 instances of the application are killed off. In general, it&#39;s preferred that this type of
500 functionality be built-in to the application (e.g. every 100th request it checks to see if there&#39;s
501 a newer version on disk and exits if so). There may be an outstanding problem (bug) when this option is
502 used with <CODE>-restart</CODE>.
503 </DD>
504 <DT>
505 <CODE><STRONG>-flush</STRONG> (none)</CODE>
506 </DT>
507 <DD>
508 Force a write to the client as data is received from the application. By default,
509 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
510 </DD>
511 <DT>
512 <CODE><STRONG>-gainValue <EM>n</EM></STRONG> (0.5)</CODE>
513 </DT>
514 <DD>
515 A floating point value between 0 and 1 used as an exponent in the computation of the exponentially
516 decayed connection times load factor of the currently running dynamic FastCGI applications. Old values
517 are scaled by (<CODE>1&nbsp;-&nbsp;gainValue</CODE>), so making it smaller weights old values more than
518 the current value (which is scaled by <CODE>gainValue</CODE>).
519 </DD>
520 <DT>
521 <CODE><STRONG>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
522 </DT>
523 <DD>
524 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
525 event is logged (at the <CODE>error</CODE> <A HREF=
526 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
527 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
528 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
529 the request will be aborted. If communication is complete with the application but incomplete with the
530 client (the response is buffered), the timeout does not apply.
531 </DD>
532 <DT>
533 <CODE><STRONG>-initial-env <EM>name[=[value]]</EM></STRONG> (none)</CODE>
534 </DT>
535 <DD>
536 A name-value pair to be passed in the initial environment when instances of applications are spawned.
537 To pass a variable from the Apache environment, don&#39;t provide the &quot;=&quot; (if the variable
538 isn&#39;t actually in the environment, it will be defined without a value). To define a variable
539 without a value, provide the &quot;=&quot; without any value. The option can be used repeatedly.
540 </DD>
541 <DT>
542 <CODE><STRONG>-init-start-delay <EM>n</EM></STRONG> (1 second)</CODE>
543 </DT>
544 <DD>
545 The minimum number of seconds between the spawning of instances of applications. This delay decreases
546 the demand placed on the system at server initialization.
547 </DD>
548 <DT>
549 <CODE><STRONG>-killInterval <EM>n</EM></STRONG> (300 seconds)</CODE>
550 </DT>
551 <DD>
552 Determines how often the dynamic application instance killing policy is implemented within the process
553 manager. Smaller numbers result in a more aggressive policy, larger numbers a less aggressive policy.
554 </DD>
555 <DT>
556 <CODE><STRONG>-listen-queue-depth <EM>n</EM></STRONG> (100)</CODE>
557 </DT>
558 <DD>
559 The depth of <CODE>listen()</CODE> queue (also known as the backlog) shared by all instances of
560 applications. A deeper listen queue allows the server to cope with transient load fluctuations without
561 rejecting requests; it does not increase throughput. Adding additional application instances may
562 increase throughput/performance, depending upon the application and the host.
563 </DD>
564 <DT>
565 <CODE><STRONG>-maxClassProcesses <EM>n</EM></STRONG> (10)</CODE>
566 </DT>
567 <DD>
568 The maximum number of dynamic FastCGI application instances allowed to run for any one FastCGI
569 application. It must be &lt;= to -maxProcesses (this is not programmatically enforced).
570 </DD>
571 <DT>
572 <CODE><STRONG>-maxProcesses <EM>n</EM></STRONG> (50)</CODE>
573 </DT>
574 <DD>
575 The maximum total number of dynamic FastCGI application instances allowed to run at any one time. It
576 must be &gt;= to -maxClassProcesses (this is not programmatically enforced).
577 </DD>
578 <DT>
579 <CODE><STRONG>-minProcesses <EM>n</EM></STRONG> (5)</CODE>
580 </DT>
581 <DD>
582 The minimum total number of dynamic FastCGI application instances allowed to run at any one time
583 without being killed off by the process manager (due to lack of demand).
584 </DD>
585 <DT>
586 <CODE><STRONG>-multiThreshold <EM>n</EM></STRONG> (50)</CODE>
587 </DT>
588 <DD>
589 An integer between 0 and 100 used to determine whether any one instance of a FastCGI application should
590 be terminated. If the application has more than one instance currently running, this attribute will be
591 used to decide whether one of them should be terminated. If only one instance remains,
592 <CODE>singleThreshold</CODE> is used instead.<BR>
593 For historic reasons the mis-spelling <CODE>multiThreshhold</CODE> is also accepted.
594 </DD>
595 <DT>
596 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
597 </DT>
598 <DD>
599 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
600 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
601 environment.
602 </DD>
603 <DT>
604 <CODE><STRONG>-priority <EM>n</EM></STRONG> (0)</CODE>
605 </DT>
606 <DD>
607 The process priority to be assigned to the application instances (using <CODE>setpriority()</CODE>).
608 </DD>
609 <DT>
610 <CODE><STRONG>-processSlack <EM>n</EM></STRONG> (5)</CODE>
611 </DT>
612 <DD>
613 If the sum of the number of all currently running dynamic FastCGI applications and
614 <CODE>processSlack</CODE> exceeds <CODE>maxProcesses</CODE>, the process manager invokes the killing
615 policy. This is to improve performance at higher loads by killing some of the most inactive application
616 instances before reaching <CODE>maxProcesses</CODE>.
617 </DD>
618 <DT>
619 <CODE><STRONG>-restart</STRONG> (none)</CODE>
620 </DT>
621 <DD>
622 Causes the process manager to restart dynamic applications upon failure (similar to static
623 applications).
624 </DD>
625 <DT>
626 <CODE><STRONG>-restart-delay <EM>n</EM></STRONG> (5 seconds)</CODE>
627 </DT>
628 <DD>
629 The minimum number of seconds between the respawning of failed instances of applications. This delay
630 prevents a broken application from soaking up too much of the system.
631 </DD>
632 <DT>
633 <CODE><STRONG>-singleThreshold <EM>n</EM></STRONG> (0)</CODE>
634 </DT>
635 <DD>
636 An integer between 0 and 100 used to determine whether the last instance of a FastCGI application can
637 be terminated. If the process manager computed load factor for the application is lower than the
638 specified threshold, the last instance is terminated. In order to make your executables run in the
639 &quot;idle&quot; mode for the long time, you would specify a value closer to 1, however if memory or
640 CPU time is of primary concern, a value closer to 100 would be more applicable. A value of 0 will
641 prevent the last instance of an application from being terminated; this is the default value, changing
642 it is not recommended (especially if <CODE>-appConnTimeout</CODE> is set).<BR>
643 For historic reasons the mis-spelling <CODE>singleThreshhold</CODE> is also accepted.
644 </DD>
645 <DT>
646 <CODE><STRONG>-startDelay <EM>n</EM></STRONG> (3 seconds)</CODE>
647 </DT>
648 <DD>
649 The number of seconds the web server waits patiently while trying to connect to a dynamic FastCGI
650 application. If the interval expires, the process manager is notified with hope it will start another
651 instance of the application. The <CODE>startDelay</CODE> must be less than <CODE>appConnTimeout</CODE>
652 to be effective.
653 </DD>
654 <DT>
655 <CODE><STRONG>-updateInterval <EM>n</EM></STRONG> (300 seconds)</CODE>
656 </DT>
657 <DD>
658 The updateInterval determines how often statistical analysis is performed to determine the fate of
659 dynamic FastCGI applications.
660 </DD>
661 </DL>
662 <HR>
663 <H2>
664 <A NAME="FastCgiExternalServer">FastCgiExternalServer</A>
665 </H2>
666 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
667 <TABLE BORDER="0" SUMMARY="">
668 <TR>
669 <TD>
670 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
671 "Help"><STRONG>Syntax:</STRONG></A>
672 </TD>
673 <TD>
674 <CODE>FastCgiExternalServer <EM>filename</EM> -host <EM>hostname:port [option ...]</EM></CODE>
675 </TD>
676 </TR>
677 <TR>
678 <TD>
679 </TD>
680 <TD>
681 <CODE>FastCgiExternalServer <EM>filename</EM> -socket <EM>filename [option ...]</EM></CODE>
682 </TD>
683 </TR>
684 <TR>
685 <TD>
686 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
687 "Help"><STRONG>Context:</STRONG></A>
688 </TD>
689 <TD>
690 server config
691 </TD>
692 </TR>
693 </TABLE>
695 The <CODE>FastCgiExternalServer</CODE> directive defines <EM>filename</EM> as an external FastCGI
696 application. If <EM>filename</EM> does not begin with a slash (/) then it is assumed to be relative to the
697 <A HREF="http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. The <EM>filename</EM> does
698 not have to exist in the local filesystem. URIs that Apache resolves to this <EM>filename</EM> will be
699 handled by this external FastCGI application..
700 </P>
702 External FastCGI applications are not started by the process manager, they are presumed to be started and
703 managed &quot;external&quot; to Apache and mod_fastcgi. The FastCGI devkit provides a simple tool,
704 <CODE>cgi-fcgi</CODE>, for starting FastCGI applications independent of the server (applications can also
705 be <EM>self-starting</EM>, see the devkit).
706 </P>
708 <EM>Option</EM> can be one of (case insensitive):
709 </P>
710 <DL>
711 <DT>
712 <CODE><STRONG>-appConnTimeout <EM>n</EM></STRONG> (0 seconds)</CODE>
713 </DT>
714 <DD>
715 <STRONG>Unix:&nbsp;</STRONG> The number of seconds to wait for a connection to the FastCGI application
716 to complete or 0 to indicate a blocking <CODE>connect()</CODE> should be used. Blocking
717 <CODE>connect()</CODE>s have an OS dependent internal timeout. If the timeout expires, a SERVER_ERROR
718 results. For non-zero values, this is the amount of time used in a <CODE>select()</CODE> to write to
719 the file descriptor returned by a non-blocking <CODE>connect()</CODE>. Non-blocking
720 <CODE>connect()</CODE>s are troublesome on many platforms. See also <CODE>-idle-timeout</CODE>, it
721 produces similar results but in a more portable manner.<BR>
722 <STRONG>Windows NT:&nbsp;</STRONG> TCP based applications work as above. Named pipe based applications
723 (static applications configured without the <CODE>-port</CODE> option and dynamic applications) use
724 this value successfully to limit the amount of time to wait for a connection (i.e. it&#39;s not
725 &quot;troublesome&quot;). By default, this is 90 seconds (FCGI_NAMED_PIPE_CONNECT_TIMEOUT in
726 mod_fastcgi.h).
727 </DD>
728 <DT>
729 <CODE><STRONG>-group <EM>groupname|#gid</EM></STRONG> (none)</CODE>
730 </DT>
731 <DD>
732 <STRONG>Unix (only):</STRONG> When <A HREF="#FastCgiWrapper">FastCgiWrapper</A> is in use, the group is
733 used to invoke the wrapper. The <CODE>-group</CODE> option must be used together with
734 <CODE>-user</CODE>.
735 </DD>
736 <DT>
737 <CODE><STRONG>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
738 </DT>
739 <DD>
740 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
741 event is logged (at the <CODE>error</CODE> <A HREF=
742 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
743 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
744 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
745 the request will be aborted. If communication is complete with the application but incomplete with the
746 client (the response is buffered), the timeout does not apply.
747 </DD>
748 <DT>
749 <CODE><STRONG>-flush</STRONG> (none)</CODE>
750 </DT>
751 <DD>
752 Force a write to the client as data is received from the application. By default,
753 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
754 </DD>
755 <DT>
756 <CODE><STRONG>-host <EM>hostname:port</EM></STRONG> (none)</CODE>
757 </DT>
758 <DD>
759 The hostname or IP address and TCP port number (1-65535) the application uses for communication with
760 the web server. The <CODE>-socket</CODE> and <CODE>-host</CODE> options are mutually exclusive.
761 </DD>
762 <DT>
763 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
764 </DT>
765 <DD>
766 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
767 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
768 environment.
769 </DD>
770 <DT>
771 <CODE><STRONG>-socket <EM>filename</EM></STRONG> (none)</CODE>
772 </DT>
773 <DD>
774 <STRONG>Unix:&nbsp;</STRONG> The filename of the Unix domain socket the application uses for
775 communication with the web server. The filename is relative to the <CODE><A HREF=
776 "#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are
777 mutually exclusive.
778 </DD>
779 <DD>
780 <STRONG>Windows NT:&nbsp;</STRONG> The name of the named pipe the application uses for communicating
781 with the web server. the name is relative to the <CODE><A HREF=
782 "#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are
783 mutually exclusive.
784 </DD>
785 <DT>
786 <CODE><STRONG>-user <EM>username|#uid</EM></STRONG> (none)</CODE>
787 </DT>
788 <DD>
789 <STRONG>Unix (only):</STRONG> When <A HREF="#FastCgiWrapper">FastCgiWrapper</A> is in use, the user is
790 used to invoke the wrapper. The <CODE>-user</CODE> option must be used together with
791 <CODE>-group</CODE>.
792 </DD>
793 </DL>
794 <HR>
795 <H2>
796 <A NAME="FastCgiIpcDir">FastCgiIpcDir</A>
797 </H2>
798 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
799 <TABLE BORDER="0" SUMMARY="">
800 <TR>
801 <TD>
802 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
803 "Help"><STRONG>Syntax:</STRONG></A>
804 </TD>
805 <TD>
806 <STRONG>Unix:&nbsp;</STRONG> <CODE>FastCgiIpcDir <EM>directory</EM></CODE>
807 </TD>
808 </TR>
809 <TR>
810 <TD>
811 </TD>
812 <TD>
813 <STRONG>Windows NT:&nbsp;</STRONG> <CODE>FastCgiIpcDir <EM>name</EM></CODE>
814 </TD>
815 </TR>
816 <TR>
817 <TD>
818 <A HREF=
819 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
820 </TD>
821 <TD>
822 <STRONG>Unix/Apache:&nbsp;</STRONG> <CODE>FastCgiIpcDir logs/fastcgi</CODE>
823 </TD>
824 </TR>
825 <TR>
826 <TD>
827 </TD>
828 <TD>
829 <STRONG>Unix/Apache2:&nbsp;</STRONG> <CODE>FastCgiIpcDir RUNTIMEDIR/fastcgi</CODE>
830 </TD>
831 </TR>
832 <TR>
833 <TD>
834 </TD>
835 <TD>
836 <STRONG>Windows NT:&nbsp;</STRONG> <CODE>FastCgiIpcDir \\\\.\\pipe\\ModFastCgi\\</CODE>
837 </TD>
838 </TR>
839 <TR>
840 <TD>
841 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
842 "Help"><STRONG>Context:</STRONG></A>
843 </TD>
844 <TD>
845 server config
846 </TD>
847 </TR>
848 </TABLE>
850 <STRONG>Unix:&nbsp;</STRONG> The <CODE>FastCgiIpcDir</CODE> directive specifies <EM>directory</EM> as the
851 place to store (and in the case of external FastCGI applications, find) the Unix socket files used for
852 communication between the applications and the web server. If the directory does not begin with a slash (/)
853 then it is assumed to be relative to the <A HREF=
854 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. If the directory doesn&#39;t exist,
855 an attempt is made to create it with appropriate permissions. Do not specify a directory that is not on a
856 local filesystem! If you use the default directory (or another directory within <CODE>/tmp</CODE>),
857 <CODE>mod_fastcgi</CODE> will break if your system periodically deletes files from <CODE>/tmp</CODE>.
858 </P>
860 <STRONG>Windows NT:&nbsp;</STRONG> The <CODE>FastCgiIpcDir</CODE> directive specifies <EM>name</EM> as the
861 root for the named pipes used for communication between the application and the web server. The
862 <EM>name</EM> must be in the form of <STRONG>\\\\.\\pipe\\</STRONG><EM>pipename</EM> (notice that the
863 backslashes are escaped). The <EM>pipename</EM> can contain any character other than a backslash.
864 </P>
866 The <CODE>FastCgiIpcDir</CODE> directive must precede any <A HREF=
867 "#FastCgiServer"><CODE>FastCgiServer</CODE></A> or <A HREF=
868 "#FastCgiExternalServer"><CODE>FastCgiExternalServer</CODE></A> directives (which make use of Unix
869 sockets). The directory must be readable, writeable, and executable (searchable) by the web server, but
870 otherwise should not be accessible to anyone.
871 </P>
873 <CODE>FastCgiIpcDir</CODE> is typically used move the directory someplace more suitable (than the default)
874 for the platform or to prevent multiple Apache instances from sharing FastCGI application instances.
875 </P>
876 <HR>
877 <H2>
878 <A NAME="FastCgiWrapper">FastCgiWrapper</A>
879 </H2>
880 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
881 <TABLE BORDER="0" SUMMARY="">
882 <TR>
883 <TD>
884 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
885 "Help"><STRONG>Syntax:</STRONG></A>
886 </TD>
887 <TD>
888 <CODE>FastCgiWrapper <EM>On | Off | filename</EM></CODE>
889 </TD>
890 </TR>
891 <TR>
892 <TD>
893 <A HREF=
894 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
895 </TD>
896 <TD>
897 <CODE>FastCgiWrapper Off</CODE>
898 </TD>
899 </TR>
900 <TR>
901 <TD>
902 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
903 "Help"><STRONG>Context:</STRONG></A>
904 </TD>
905 <TD>
906 server config
907 </TD>
908 </TR>
909 </TABLE>
911 <STRONG>Unix (only):</STRONG> The <CODE>FastCgiWrapper</CODE> directive is used to enable support for a
912 wrapper such as <A HREF="http://httpd.apache.org/docs/suexec.html">suexec</A> (included with Apache in the
913 support directory) or <A HREF="http://cgiwrap.sourceforge.net/">cgiwrap</A>. To use the same wrapper used
914 by Apache, set <CODE>FastCgiWrapper</CODE> to <EM>On</EM> (NOTE - mod_fastcgi cannot reliably determine the
915 wrapper used by Apache when built as a DSO). The <EM>On</EM> argument requires suexec be enabled in Apache
916 (for CGI). To use a specific wrapper, specify a <EM>filename</EM>. If the filename does not begin with a
917 slash (/) then it is assumed to be relative to the <A HREF=
918 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. The wrapper is used to invoke all
919 FastCGI applications (in the future this directive will have directory context).
920 </P>
922 When <CODE>FastCgiWrapper</CODE> is enabled, no assumptions are made about the target application and thus
923 presence and permissions checks cannot be made. This is the responsibility of the wrapper.
924 </P>
926 The wrapper is invoked with the following arguments: username, group, application. The username and group
927 are determined as described below. The application is the &quot;filename&quot; Apache resolves the
928 requested URI to (dynamic) or the filename provided as an argument to another FastCGI (server or
929 authorizer) directive. These arguments may or may not be used by the wrapper (e.g. suexec uses them,
930 cgiwrap parses the URI and ignores them). The environment passed to the wrapper is identical to the
931 environment passed when a wrapper is not in use.
932 </P>
934 When <CODE>FastCgiWrapper</CODE> is enabled, the location of static or external FastCGI application
935 directives can be important. Under Apache 1.3, they inherit their user and group from the <CODE>user and
936 group</CODE> of the virtual server in which they are defined. <CODE><A HREF=
937 "http://httpd.apache.org/docs/mod/core.html#user">User</A></CODE> and <CODE><A HREF=
938 "http://httpd.apache.org/docs/mod/core.html#group">Group</A></CODE> directives <I><U>must</U></I> precede
939 FastCGI application definitions. Under Apache 2.0, the <CODE>-user</CODE> and <CODE>-group</CODE> options
940 to <A HREF="#FastCgiServer">FastCgiServer</A> and <A HREF=
941 "#FastCgiExternalServer">FastCgiExternalServer</A> directives must be used (dynamic applications still use
942 the virtual server&#39;s user and group).
943 </P>
945 Note that access to (use of) FastCGI applications is <U><I>not</I></U> limited to the virtual server in
946 which they were defined. The application is used to service requests from any virtual server with the same
947 user and group.
948 </P>
950 If a request is received for a FastCGI application without an existing matching definition already running
951 with the correct user and group, a dynamic instance of the application is started with the correct user and
952 group. This can lead to multiple copies of the same application running with different user/group. If this
953 is a problem, preclude navigation to the application from other virtual servers or configure the virtual
954 servers with the same User and Group.
955 </P>
957 See the Apache documentation for more information about suexec (make sure you fully understand the security
958 implications).
959 </P>
960 <HR>
961 <H2>
962 <A NAME="FastCgiAuthenticator">FastCgiAuthenticator</A>
963 </H2>
964 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
965 <TABLE BORDER="0" SUMMARY="">
966 <TR>
967 <TD>
968 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
969 "Help"><STRONG>Syntax:</STRONG></A>
970 </TD>
971 <TD>
972 <CODE>FastCgiAuthenticator <EM>filename</EM> [-compat]</CODE>
973 </TD>
974 </TR>
975 <TR>
976 <TD>
977 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
978 "Help"><STRONG>Context:</STRONG></A>
979 </TD>
980 <TD>
981 directory
982 </TD>
983 </TR>
984 </TABLE>
986 The <CODE>FastCgiAuthenticator</CODE> directive is used to define a FastCGI application as a per-directory
987 authenticator. Authenticators verify the requestor is who he says he is by matching the provided username
988 and password against a list or database of known users and passwords. FastCGI based authenticators are
989 useful primarily when the user database is maintained within an existing independent program or resides on
990 a machine other than the web server.
991 </P>
993 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
994 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
995 then it is assumed to be relative to the <A HREF=
996 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
997 </P>
999 <CODE>FastCgiAuthenticator</CODE> is used within <A HREF=
1000 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
1001 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers and must include
1002 an <A HREF="http://httpd.apache.org/docs/mod/core.html#authtype"><CODE>AuthType</CODE></A> and <A HREF=
1003 "http://httpd.apache.org/docs/mod/core.html#authname"><CODE>AuthName</CODE></A> directive. Only the
1004 <CODE>Basic</CODE> user authentication type is supported. It must be accompanied by a <A HREF=
1005 "http://httpd.apache.org/docs/mod/core.html#require"><CODE>require</CODE></A> or <CODE><A HREF=
1006 "#FastCgiAuthorizer">FastCgiAuthorizer</A></CODE> directive in order to work correctly.
1007 </P>
1008 <BLOCKQUOTE>
1009 <PRE>
1010 &lt;Directory htdocs/protected&gt;
1011 AuthType Basic
1012 AuthName ProtectedRealm
1013 FastCgiAuthenticator fcgi-bin/authenticator
1014 require valid-user
1015 &lt;/Directory&gt;
1016 </PRE>
1017 </BLOCKQUOTE>
1019 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
1020 CGI/FastCGI request handlers. All headers returned by a FastCGI authentication application in a successful
1021 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
1022 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
1023 behavior can be obtained by using the <CODE>-compat</CODE> option.
1024 </P>
1026 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
1027 &quot;AUTHENTICATOR&quot; to indicate which (Apache specific) authorizer phase is being performed.
1028 </P>
1030 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
1031 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
1032 FastCGI application can serve the document).
1033 </P>
1034 <HR>
1035 <H2>
1036 <A NAME="FastCgiAuthenticatorAuthoritative">FastCgiAuthenticatorAuthoritative</A>
1037 </H2>
1038 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1039 <TABLE BORDER="0" SUMMARY="">
1040 <TR>
1041 <TD>
1042 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1043 "Help"><STRONG>Syntax:</STRONG></A>
1044 </TD>
1045 <TD>
1046 <CODE>FastCgiAuthenticatorAuthoritative <EM>On | Off</EM></CODE>
1047 </TD>
1048 </TR>
1049 <TR>
1050 <TD>
1051 <A HREF=
1052 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1053 </TD>
1054 <TD>
1055 <CODE>FastCgiAuthenticatorAuthoritative On</CODE>
1056 </TD>
1057 </TR>
1058 <TR>
1059 <TD>
1060 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1061 "Help"><STRONG>Context:</STRONG></A>
1062 </TD>
1063 <TD>
1064 directory
1065 </TD>
1066 </TR>
1067 </TABLE>
1069 Setting the <CODE>FastCgiAuthenticatorAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1070 authentication to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1071 <CODE>modules.c</CODE> files) if the FastCGI application fails to authenticate the user.
1072 </P>
1074 A common use for this is in conjunction with a well protected <A HREF=
1075 "http://httpd.apache.org/docs/mod/mod_auth.html#authuserfile"><CODE>AuthUserFile</CODE></A> containing a
1076 few (administration related) users.
1077 </P>
1079 By default, control is not passed on and an unknown user will result in an Authorization Required reply.
1080 Disabling the default should be carefully considered.
1081 </P>
1082 <HR>
1083 <H2>
1084 <A NAME="FastCgiAuthorizer">FastCgiAuthorizer</A>
1085 </H2>
1086 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1087 <TABLE BORDER="0" SUMMARY="">
1088 <TR>
1089 <TD>
1090 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1091 "Help"><STRONG>Syntax:</STRONG></A>
1092 </TD>
1093 <TD>
1094 <CODE>FastCgiAuthorizer <EM>filename</EM> [-compat]</CODE>
1095 </TD>
1096 </TR>
1097 <TR>
1098 <TD>
1099 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1100 "Help"><STRONG>Context:</STRONG></A>
1101 </TD>
1102 <TD>
1103 directory
1104 </TD>
1105 </TR>
1106 </TABLE>
1108 The <CODE>FastCgiAuthorizer</CODE> directive is used to define a FastCGI application as a per-directory
1109 authorizer. Authorizers validate whether an authenticated requestor is allowed access to the requested
1110 resource. FastCGI based authorizers are useful primarily when there is a dynamic component to the
1111 authorization decision such as a time of day or whether or not the user has paid his bills.
1112 </P>
1114 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
1115 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
1116 then it is assumed to be relative to the <A HREF=
1117 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
1118 </P>
1120 <CODE>FastCgiAuthorizer</CODE> is used within <A HREF=
1121 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
1122 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers and must include
1123 an <A HREF="http://httpd.apache.org/docs/mod/core.html#authtype"><CODE>AuthType</CODE></A> and <A HREF=
1124 "http://httpd.apache.org/docs/mod/core.html#authname"><CODE>AuthName</CODE></A> directive. It must be
1125 accompanied by an authentication directive such as <A HREF=
1126 "#FastCgiAuthenticator"><CODE>FastCgiAuthenticator</CODE></A>, <A HREF=
1127 "http://httpd.apache.org/docs/mod/mod_auth.html#authuserfile"><CODE>AuthUserFile</CODE></A>, <A HREF=
1128 "http://httpd.apache.org/docs/mod/mod_auth_db.html#authdbuserfile"><CODE>AuthDBUserFile</CODE></A> or <A
1129 HREF="http://httpd.apache.org/docs/mod/mod_auth_dbm.html#authdbmuserfile"><CODE>AuthDBMUserFile</CODE></A>
1130 in order to work correctly.
1131 </P>
1132 <BLOCKQUOTE>
1133 <PRE>
1134 &lt;Directory htdocs/protected&gt;
1135 AuthType Basic
1136 AuthName ProtectedRealm
1137 AuthDBMUserFile conf/authentication-database
1138 FastCgiAuthorizer fcgi-bin/authorizer
1139 &lt;/Directory&gt;
1140 </PRE>
1141 </BLOCKQUOTE>
1143 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
1144 CGI/FastCGI request handlers. All headers returned by a FastCGI authorizer application in a successful
1145 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
1146 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
1147 behavior can be obtained by using the <CODE>-compat</CODE> option.
1148 </P>
1150 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
1151 &quot;AUTHORIZER&quot; to indicate which (Apache specific) authorizer phase is being performed.
1152 </P>
1154 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
1155 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
1156 FastCGI application can serve the document).
1157 </P>
1158 <HR>
1159 <H2>
1160 <A NAME="FastCgiAuthorizerAuthoritative">FastCgiAuthorizerAuthoritative</A>
1161 </H2>
1162 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1163 <TABLE BORDER="0" SUMMARY="">
1164 <TR>
1165 <TD>
1166 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1167 "Help"><STRONG>Syntax:</STRONG></A>
1168 </TD>
1169 <TD>
1170 <CODE>FastCgiAuthorizerAuthoritative <EM>On | Off</EM></CODE>
1171 </TD>
1172 </TR>
1173 <TR>
1174 <TD>
1175 <A HREF=
1176 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1177 </TD>
1178 <TD>
1179 <CODE>FastCgiAuthorizerAuthoritative On</CODE>
1180 </TD>
1181 </TR>
1182 <TR>
1183 <TD>
1184 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1185 "Help"><STRONG>Context:</STRONG></A>
1186 </TD>
1187 <TD>
1188 directory
1189 </TD>
1190 </TR>
1191 </TABLE>
1193 Setting the <CODE>FastCgiAuthorizerAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1194 authorization to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1195 <CODE>modules.c</CODE> files) if the FastCGI application fails to authorize the user.
1196 </P>
1198 By default, control is not passed on and an unauthorized user will result in an Authorization Required
1199 reply. Disabling the default should be carefully considered.
1200 </P>
1201 <HR>
1202 <H2>
1203 <A NAME="FastCgiAccessChecker">FastCgiAccessChecker</A>
1204 </H2>
1205 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1206 <TABLE BORDER="0" SUMMARY="">
1207 <TR>
1208 <TD>
1209 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1210 "Help"><STRONG>Syntax:</STRONG></A>
1211 </TD>
1212 <TD>
1213 <CODE>FastCgiAccessChecker <EM>filename</EM> [-compat]</CODE>
1214 </TD>
1215 </TR>
1216 <TR>
1217 <TD>
1218 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1219 "Help"><STRONG>Context:</STRONG></A>
1220 </TD>
1221 <TD>
1222 directory
1223 </TD>
1224 </TR>
1225 </TABLE>
1227 The <CODE>FastCgiAccessChecker</CODE> (suggestions for a better name are welcome) directive is used to
1228 define a FastCGI application as a per-directory access validator. The Apache Access phase precede user
1229 authentication and thus the decision to (dis)allow access to the requested resource is based on the HTTP
1230 headers submitted with the request. FastCGI based authorizers are useful primarily when there is a dynamic
1231 component to the access validation decision such as a time of day or whether or not a domain has paid his
1232 bills.
1233 </P>
1235 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
1236 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
1237 then it is assumed to be relative to the <A HREF=
1238 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
1239 </P>
1241 <CODE>FastCgiAccessChecker</CODE> is used within <A HREF=
1242 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
1243 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers.
1244 </P>
1245 <BLOCKQUOTE>
1246 <PRE>
1247 &lt;Directory htdocs/protected&gt;
1248 FastCgiAccessChecker fcgi-bin/access-checker
1249 &lt;/Directory&gt;
1250 </PRE>
1251 </BLOCKQUOTE>
1253 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
1254 CGI/FastCGI request handlers. All headers returned by a FastCGI access-checker application in a successful
1255 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
1256 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
1257 behavior can be obtained by using the <CODE>-compat</CODE> option.
1258 </P>
1260 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
1261 &quot;ACCESS_CHECKER&quot; to indicate which (Apache specific) authorizer phase is being performed.
1262 </P>
1264 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
1265 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
1266 FastCGI application can serve the document).
1267 </P>
1268 <HR>
1269 <H2>
1270 <A NAME="FastCgiAccessCheckerAuthoritative">FastCgiAccessCheckerAuthoritative</A>
1271 </H2>
1272 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1273 <TABLE BORDER="0" SUMMARY="">
1274 <TR>
1275 <TD>
1276 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1277 "Help"><STRONG>Syntax:</STRONG></A>
1278 </TD>
1279 <TD>
1280 <CODE>FastCgiAccessCheckerAuthoritative <EM>On | Off</EM></CODE>
1281 </TD>
1282 </TR>
1283 <TR>
1284 <TD>
1285 <A HREF=
1286 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1287 </TD>
1288 <TD>
1289 <CODE>FastCgiAccessCheckerAuthoritative On</CODE>
1290 </TD>
1291 </TR>
1292 <TR>
1293 <TD>
1294 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1295 "Help"><STRONG>Context:</STRONG></A>
1296 </TD>
1297 <TD>
1298 directory
1299 </TD>
1300 </TR>
1301 </TABLE>
1303 Setting the <CODE>FastCgiAccessCheckerAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1304 access checking to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1305 <CODE>modules.c</CODE> files) if the FastCGI application fails to allow access.
1306 </P>
1308 By default, control is not passed on and a failed access check will result in a Forbidden reply. Disabling
1309 the default should be carefully considered.
1310 </P>
1311 <HR>
1312 <H3 CLASS="c3">
1313 <A HREF="http://www.FastCGI.com/">www.FastCGI.com</A>
1314 </H3>
1315 </BODY>
1316 </HTML>