Clarify the lack of support of multiplexing.
[mod_fastcgi.git] / docs / mod_fastcgi.html
blobef8d144f34dada2e765b1a98d6f9867f0f0820ea
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <!-- $Id: mod_fastcgi.html,v 1.30 2001/12/18 01:54:42 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>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
321 </DT>
322 <DD>
323 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
324 event is logged (at the <CODE>error</CODE> <A HREF=
325 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
326 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
327 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
328 the request will be aborted. If communication is complete with the application but incomplete with the
329 client (the response is buffered), the timeout does not apply.
330 </DD>
331 <DT>
332 <CODE><STRONG>-initial-env <EM>name[=[value]]</EM></STRONG> (none)</CODE>
333 </DT>
334 <DD>
335 A name-value pair to be passed in the FastCGI application&#39;s <EM>initial</EM> environment. To pass a
336 variable from Apache&#39;s environment, don&#39;t provide the &quot;=&quot; (if the variable isn&#39;t
337 actually in the environment, it will be defined without a value). To define a variable without a value,
338 provide the &quot;=&quot; without any value. The option can be used repeatedly.
339 </DD>
340 <DT>
341 <CODE><STRONG>-init-start-delay <EM>n</EM></STRONG> (1 second)</CODE>
342 </DT>
343 <DD>
344 The minimum number of seconds between the spawning of instances of this application. This delay
345 decreases the demand placed on the system at server initialization.
346 </DD>
347 <DT>
348 <CODE><STRONG>-flush</STRONG> (none)</CODE>
349 </DT>
350 <DD>
351 Force a write to the client as data is received from the application. By default,
352 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
353 </DD>
354 <DT>
355 <CODE><STRONG>-listen-queue-depth <EM>n</EM></STRONG> (100)</CODE>
356 </DT>
357 <DD>
358 The depth of <CODE>listen()</CODE> queue (also known as the backlog) shared by all of the instances of
359 this application. A deeper listen queue allows the server to cope with transient load fluctuations
360 without rejecting requests; it does not increase throughput. Adding additional application instances
361 may increase throughput/performance, depending upon the application and the host.
362 </DD>
363 <DT>
364 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
365 </DT>
366 <DD>
367 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
368 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
369 environment.
370 </DD>
371 <DT>
372 <CODE><STRONG>-port <EM>n</EM></STRONG> (none)</CODE>
373 </DT>
374 <DD>
375 The TCP port number (1-65535) the application will use for communication with the web server. This
376 option makes the application accessible from other machines on the network (as well as this one). The
377 <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually exclusive.
378 </DD>
379 <DT>
380 <CODE><STRONG>-priority <EM>n</EM></STRONG> (0)</CODE>
381 </DT>
382 <DD>
383 The process priority to be assigned to the application instances (using <CODE>setpriority()</CODE>).
384 </DD>
385 <DT>
386 <CODE><STRONG>-processes <EM>n</EM></STRONG> (1)</CODE>
387 </DT>
388 <DD>
389 The number of instances of the application to spawn at server initialization.
390 </DD>
391 <DT>
392 <CODE><STRONG>-restart-delay <EM>n</EM></STRONG> (5 seconds)</CODE>
393 </DT>
394 <DD>
395 The minimum number of seconds between the respawning of failed instances of this application. This
396 delay prevents a broken application from soaking up too much of the system.
397 </DD>
398 <DT>
399 <CODE><STRONG>-socket <EM>filename</EM></STRONG> (generated)</CODE>
400 </DT>
401 <DD>
402 <STRONG>Unix:&nbsp;</STRONG> The filename of the Unix domain socket that the application will use for
403 communication with the web server. The module creates the socket within the directory specified by
404 <CODE><A HREF="#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. This option makes the application accessible
405 to other applications (e.g. <CODE>cgi-fcgi</CODE>) on the same machine or via an external FastCGI
406 application definition (<CODE><A HREF="#FastCgiExternalServer">FastCgiExternalServer</A></CODE>). If
407 neither the <CODE>-socket</CODE> nor the <CODE>-port</CODE> options are given, the module generates a
408 Unix domain socket filename. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually
409 exclusive.
410 </DD>
411 <DD>
412 <STRONG>Windows NT:&nbsp;</STRONG> The name of the named pipe that the application will use for
413 communication with the web server. The module creates the named pipe under the named pipe root
414 specified by <CODE><A HREF="#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. This option makes the application
415 accessible to other applications (e.g. <CODE>cgi-fcgi</CODE>) on the same machine or via an external
416 FastCGI application definition (<CODE><A HREF=
417 "#FastCgiExternalServer">FastCgiExternalServer</A></CODE>). If neither the <CODE>-socket</CODE> nor the
418 <CODE>-port</CODE> options are given, the module generates a name for the named pipe. The
419 <CODE>-socket</CODE> and <CODE>-port</CODE> options are mutually exclusive.
420 </DD>
421 </DL>
422 <HR>
423 <H2>
424 <A NAME="FastCgiConfig">FastCgiConfig</A>
425 </H2>
426 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
427 <TABLE BORDER="0" SUMMARY="">
428 <TR>
429 <TD>
430 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
431 "Help"><STRONG>Syntax:</STRONG></A>
432 </TD>
433 <TD>
434 <CODE>FastCgiConfig <EM>option [option ...]</EM></CODE>
435 </TD>
436 </TR>
437 <TR>
438 <TD>
439 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
440 "Help"><STRONG>Context:</STRONG></A>
441 </TD>
442 <TD>
443 server config
444 </TD>
445 </TR>
446 </TABLE>
448 The <CODE>FastCgiConfig</CODE> directive defines the default parameters for <EM>all</EM> dynamic FastCGI
449 applications. This directive does not affect static or external applications in any way.
450 </P>
452 Dynamic applications are not started at server initialization, but upon demand. If the demand is heavy,
453 additional application instances are started. As the demand fades, application instances are killed off.
454 Many of the options govern this process.
455 </P>
457 <EM>Option</EM> can be one of (case insensitive):
458 </P>
459 <DL>
460 <DT>
461 <CODE><STRONG>-appConnTimeout <EM>n</EM></STRONG> (0 seconds)</CODE>
462 </DT>
463 <DD>
464 <STRONG>Unix:&nbsp;</STRONG> The number of seconds to wait for a connection to the FastCGI application
465 to complete or 0 to indicate a blocking <CODE>connect()</CODE> should be used. Blocking
466 <CODE>connect()</CODE>s have an OS dependent internal timeout. If the timeout expires, a SERVER_ERROR
467 results. For non-zero values, this is the amount of time used in a <CODE>select()</CODE> to write to
468 the file descriptor returned by a non-blocking <CODE>connect()</CODE>. Non-blocking
469 <CODE>connect()</CODE>s are troublesome on many platforms. See also <CODE>-idle-timeout</CODE>, it
470 produces similar results but in a more portable manner.<BR>
471 <STRONG>Windows NT:&nbsp;</STRONG> TCP based applications work as above. Named pipe based applications
472 (static applications configured without the <CODE>-port</CODE> option and dynamic applications) use
473 this value successfully to limit the amount of time to wait for a connection (i.e. it&#39;s not
474 &quot;troublesome&quot;). By default, this is 90 seconds (FCGI_NAMED_PIPE_CONNECT_TIMEOUT in
475 mod_fastcgi.h).
476 </DD>
477 <DT>
478 <CODE><STRONG>-autoUpdate</STRONG> (none)</CODE>
479 </DT>
480 <DD>
481 Causes mod_fastcgi to check the modification time of the application on disk before processing each
482 request. If the application on disk has been changed, the process manager is notified and all running
483 instances of the application are killed off. In general, it&#39;s preferred that this type of
484 functionality be built-in to the application (e.g. every 100th request it checks to see if there&#39;s
485 a newer version on disk and exits if so). There may be an outstanding problem (bug) when this option is
486 used with <CODE>-restart</CODE>.
487 </DD>
488 <DT>
489 <CODE><STRONG>-flush</STRONG> (none)</CODE>
490 </DT>
491 <DD>
492 Force a write to the client as data is received from the application. By default,
493 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
494 </DD>
495 <DT>
496 <CODE><STRONG>-gainValue <EM>n</EM></STRONG> (0.5)</CODE>
497 </DT>
498 <DD>
499 A floating point value between 0 and 1 used as an exponent in the computation of the exponentially
500 decayed connection times load factor of the currently running dynamic FastCGI applications. Old values
501 are scaled by (<CODE>1&nbsp;-&nbsp;gainValue</CODE>), so making it smaller weights old values more than
502 the current value (which is scaled by <CODE>gainValue</CODE>).
503 </DD>
504 <DT>
505 <CODE><STRONG>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
506 </DT>
507 <DD>
508 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
509 event is logged (at the <CODE>error</CODE> <A HREF=
510 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
511 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
512 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
513 the request will be aborted. If communication is complete with the application but incomplete with the
514 client (the response is buffered), the timeout does not apply.
515 </DD>
516 <DT>
517 <CODE><STRONG>-initial-env <EM>name[=[value]]</EM></STRONG> (none)</CODE>
518 </DT>
519 <DD>
520 A name-value pair to be passed in the initial environment when instances of applications are spawned.
521 To pass a variable from the Apache environment, don&#39;t provide the &quot;=&quot; (if the variable
522 isn&#39;t actually in the environment, it will be defined without a value). To define a variable
523 without a value, provide the &quot;=&quot; without any value. The option can be used repeatedly.
524 </DD>
525 <DT>
526 <CODE><STRONG>-init-start-delay <EM>n</EM></STRONG> (1 second)</CODE>
527 </DT>
528 <DD>
529 The minimum number of seconds between the spawning of instances of applications. This delay decreases
530 the demand placed on the system at server initialization.
531 </DD>
532 <DT>
533 <CODE><STRONG>-killInterval <EM>n</EM></STRONG> (300 seconds)</CODE>
534 </DT>
535 <DD>
536 Determines how often the dynamic application instance killing policy is implemented within the process
537 manager. Smaller numbers result in a more aggressive policy, larger numbers a less aggressive policy.
538 </DD>
539 <DT>
540 <CODE><STRONG>-listen-queue-depth <EM>n</EM></STRONG> (100)</CODE>
541 </DT>
542 <DD>
543 The depth of <CODE>listen()</CODE> queue (also known as the backlog) shared by all instances of
544 applications. A deeper listen queue allows the server to cope with transient load fluctuations without
545 rejecting requests; it does not increase throughput. Adding additional application instances may
546 increase throughput/performance, depending upon the application and the host.
547 </DD>
548 <DT>
549 <CODE><STRONG>-maxClassProcesses <EM>n</EM></STRONG> (10)</CODE>
550 </DT>
551 <DD>
552 The maximum number of dynamic FastCGI application instances allowed to run for any one FastCGI
553 application. It must be &lt;= to -maxProcesses (this is not programmatically enforced).
554 </DD>
555 <DT>
556 <CODE><STRONG>-maxProcesses <EM>n</EM></STRONG> (50)</CODE>
557 </DT>
558 <DD>
559 The maximum total number of dynamic FastCGI application instances allowed to run at any one time. It
560 must be &gt;= to -maxClassProcesses (this is not programmatically enforced).
561 </DD>
562 <DT>
563 <CODE><STRONG>-minProcesses <EM>n</EM></STRONG> (5)</CODE>
564 </DT>
565 <DD>
566 The minimum total number of dynamic FastCGI application instances allowed to run at any one time
567 without being killed off by the process manager (due to lack of demand).
568 </DD>
569 <DT>
570 <CODE><STRONG>-multiThreshold <EM>n</EM></STRONG> (50)</CODE>
571 </DT>
572 <DD>
573 An integer between 0 and 100 used to determine whether any one instance of a FastCGI application should
574 be terminated. If the application has more than one instance currently running, this attribute will be
575 used to decide whether one of them should be terminated. If only one instance remains,
576 <CODE>singleThreshold</CODE> is used instead.<BR>
577 For historic reasons the mis-spelling <CODE>multiThreshhold</CODE> is also accepted.
578 </DD>
579 <DT>
580 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
581 </DT>
582 <DD>
583 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
584 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
585 environment.
586 </DD>
587 <DT>
588 <CODE><STRONG>-priority <EM>n</EM></STRONG> (0)</CODE>
589 </DT>
590 <DD>
591 The process priority to be assigned to the application instances (using <CODE>setpriority()</CODE>).
592 </DD>
593 <DT>
594 <CODE><STRONG>-processSlack <EM>n</EM></STRONG> (5)</CODE>
595 </DT>
596 <DD>
597 If the sum of the number of all currently running dynamic FastCGI applications and
598 <CODE>processSlack</CODE> exceeds <CODE>maxProcesses</CODE>, the process manager invokes the killing
599 policy. This is to improve performance at higher loads by killing some of the most inactive application
600 instances before reaching <CODE>maxProcesses</CODE>.
601 </DD>
602 <DT>
603 <CODE><STRONG>-restart</STRONG> (none)</CODE>
604 </DT>
605 <DD>
606 Causes the process manager to restart dynamic applications upon failure (similar to static
607 applications).
608 </DD>
609 <DT>
610 <CODE><STRONG>-restart-delay <EM>n</EM></STRONG> (5 seconds)</CODE>
611 </DT>
612 <DD>
613 The minimum number of seconds between the respawning of failed instances of applications. This delay
614 prevents a broken application from soaking up too much of the system.
615 </DD>
616 <DT>
617 <CODE><STRONG>-singleThreshold <EM>n</EM></STRONG> (0)</CODE>
618 </DT>
619 <DD>
620 An integer between 0 and 100 used to determine whether the last instance of a FastCGI application can
621 be terminated. If the process manager computed load factor for the application is lower than the
622 specified threshold, the last instance is terminated. In order to make your executables run in the
623 &quot;idle&quot; mode for the long time, you would specify a value closer to 1, however if memory or
624 CPU time is of primary concern, a value closer to 100 would be more applicable. A value of 0 will
625 prevent the last instance of an application from being terminated; this is the default value, changing
626 it is not recommended (especially if <CODE>-appConnTimeout</CODE> is set).<BR>
627 For historic reasons the mis-spelling <CODE>singleThreshhold</CODE> is also accepted.
628 </DD>
629 <DT>
630 <CODE><STRONG>-startDelay <EM>n</EM></STRONG> (3 seconds)</CODE>
631 </DT>
632 <DD>
633 The number of seconds the web server waits patiently while trying to connect to a dynamic FastCGI
634 application. If the interval expires, the process manager is notified with hope it will start another
635 instance of the application. The <CODE>startDelay</CODE> must be less than <CODE>appConnTimeout</CODE>
636 to be effective.
637 </DD>
638 <DT>
639 <CODE><STRONG>-updateInterval <EM>n</EM></STRONG> (300 seconds)</CODE>
640 </DT>
641 <DD>
642 The updateInterval determines how often statistical analysis is performed to determine the fate of
643 dynamic FastCGI applications.
644 </DD>
645 </DL>
646 <HR>
647 <H2>
648 <A NAME="FastCgiExternalServer">FastCgiExternalServer</A>
649 </H2>
650 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
651 <TABLE BORDER="0" SUMMARY="">
652 <TR>
653 <TD>
654 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
655 "Help"><STRONG>Syntax:</STRONG></A>
656 </TD>
657 <TD>
658 <CODE>FastCgiExternalServer <EM>filename</EM> -host <EM>hostname:port [option ...]</EM></CODE>
659 </TD>
660 </TR>
661 <TR>
662 <TD>
663 </TD>
664 <TD>
665 <CODE>FastCgiExternalServer <EM>filename</EM> -socket <EM>filename [option ...]</EM></CODE>
666 </TD>
667 </TR>
668 <TR>
669 <TD>
670 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
671 "Help"><STRONG>Context:</STRONG></A>
672 </TD>
673 <TD>
674 server config
675 </TD>
676 </TR>
677 </TABLE>
679 The <CODE>FastCgiExternalServer</CODE> directive defines <EM>filename</EM> as an external FastCGI
680 application. If <EM>filename</EM> does not begin with a slash (/) then it is assumed to be relative to the
681 <A HREF="http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. The <EM>filename</EM> does
682 not have to exist in the local filesystem. URIs that Apache resolves to this <EM>filename</EM> will be
683 handled by this external FastCGI application..
684 </P>
686 External FastCGI applications are not started by the process manager, they are presumed to be started and
687 managed &quot;external&quot; to Apache and mod_fastcgi. The FastCGI devkit provides a simple tool,
688 <CODE>cgi-fcgi</CODE>, for starting FastCGI applications independent of the server (applications can also
689 be <EM>self-starting</EM>, see the devkit).
690 </P>
692 <EM>Option</EM> can be one of (case insensitive):
693 </P>
694 <DL>
695 <DT>
696 <CODE><STRONG>-appConnTimeout <EM>n</EM></STRONG> (0 seconds)</CODE>
697 </DT>
698 <DD>
699 <STRONG>Unix:&nbsp;</STRONG> The number of seconds to wait for a connection to the FastCGI application
700 to complete or 0 to indicate a blocking <CODE>connect()</CODE> should be used. Blocking
701 <CODE>connect()</CODE>s have an OS dependent internal timeout. If the timeout expires, a SERVER_ERROR
702 results. For non-zero values, this is the amount of time used in a <CODE>select()</CODE> to write to
703 the file descriptor returned by a non-blocking <CODE>connect()</CODE>. Non-blocking
704 <CODE>connect()</CODE>s are troublesome on many platforms. See also <CODE>-idle-timeout</CODE>, it
705 produces similar results but in a more portable manner.<BR>
706 <STRONG>Windows NT:&nbsp;</STRONG> TCP based applications work as above. Named pipe based applications
707 (static applications configured without the <CODE>-port</CODE> option and dynamic applications) use
708 this value successfully to limit the amount of time to wait for a connection (i.e. it&#39;s not
709 &quot;troublesome&quot;). By default, this is 90 seconds (FCGI_NAMED_PIPE_CONNECT_TIMEOUT in
710 mod_fastcgi.h).
711 </DD>
712 <DT>
713 <CODE><STRONG>-idle-timeout <EM>n</EM></STRONG> (30 seconds)</CODE>
714 </DT>
715 <DD>
716 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the
717 event is logged (at the <CODE>error</CODE> <A HREF=
718 "http://httpd.apache.org/docs/mod/core.html#loglevel"><CODE>LogLevel</CODE></A>). The inactivity timer
719 applies only as long as a connection is pending with the FastCGI application. If a request is queued to
720 an application, but the application doesn&#39;t respond (by writing and flushing) within this period,
721 the request will be aborted. If communication is complete with the application but incomplete with the
722 client (the response is buffered), the timeout does not apply.
723 </DD>
724 <DT>
725 <CODE><STRONG>-flush</STRONG> (none)</CODE>
726 </DT>
727 <DD>
728 Force a write to the client as data is received from the application. By default,
729 <CODE>mod_fastcgi</CODE> buffers data in order to free the application as quickly as possible.
730 </DD>
731 <DT>
732 <CODE><STRONG>-host <EM>hostname:port</EM></STRONG> (none)</CODE>
733 </DT>
734 <DD>
735 The hostname or IP address and TCP port number (1-65535) the application uses for communication with
736 the web server. The <CODE>-socket</CODE> and <CODE>-host</CODE> options are mutually exclusive.
737 </DD>
738 <DT>
739 <CODE><STRONG>-pass-header <EM>header</EM></STRONG> (none)</CODE>
740 </DT>
741 <DD>
742 The name of an HTTP Request Header to be passed in the <EM>request</EM> environment. This option makes
743 available the contents of headers which are normally not available (e.g. Authorization) to a CGI
744 environment.
745 </DD>
746 <DT>
747 <CODE><STRONG>-socket <EM>filename</EM></STRONG> (none)</CODE>
748 </DT>
749 <DD>
750 <STRONG>Unix:&nbsp;</STRONG> The filename of the Unix domain socket the application uses for
751 communication with the web server. The filename is relative to the <CODE><A HREF=
752 "#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are
753 mutually exclusive.
754 </DD>
755 <DD>
756 <STRONG>Windows NT:&nbsp;</STRONG> The name of the named pipe the application uses for communicating
757 with the web server. the name is relative to the <CODE><A HREF=
758 "#FastCgiIpcDir">FastCgiIpcDir</A></CODE>. The <CODE>-socket</CODE> and <CODE>-port</CODE> options are
759 mutually exclusive.
760 </DD>
761 </DL>
762 <HR>
763 <H2>
764 <A NAME="FastCgiIpcDir">FastCgiIpcDir</A>
765 </H2>
766 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
767 <TABLE BORDER="0" SUMMARY="">
768 <TR>
769 <TD>
770 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
771 "Help"><STRONG>Syntax:</STRONG></A>
772 </TD>
773 <TD>
774 <STRONG>Unix:&nbsp;</STRONG> <CODE>FastCgiIpcDir <EM>directory</EM></CODE>
775 </TD>
776 </TR>
777 <TR>
778 <TD>
779 </TD>
780 <TD>
781 <STRONG>Windows NT:&nbsp;</STRONG> <CODE>FastCgiIpcDir <EM>name</EM></CODE>
782 </TD>
783 </TR>
784 <TR>
785 <TD>
786 <A HREF=
787 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
788 </TD>
789 <TD>
790 <STRONG>Unix:&nbsp;</STRONG> <CODE>FastCgiIpcDir /tmp/fcgi</CODE>
791 </TD>
792 </TR>
793 <TR>
794 <TD>
795 </TD>
796 <TD>
797 <STRONG>Windows NT:&nbsp;</STRONG> <CODE>FastCgiIpcDir \\.\pipe\ModFastCgi\</CODE>
798 </TD>
799 </TR>
800 <TR>
801 <TD>
802 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
803 "Help"><STRONG>Context:</STRONG></A>
804 </TD>
805 <TD>
806 server config
807 </TD>
808 </TR>
809 </TABLE>
811 <STRONG>Unix:&nbsp;</STRONG> The <CODE>FastCgiIpcDir</CODE> directive specifies <EM>directory</EM> as the
812 place to store (and in the case of external FastCGI applications, find) the Unix socket files used for
813 communication between the applications and the web server. If the directory does not begin with a slash (/)
814 then it is assumed to be relative to the <A HREF=
815 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. If the directory doesn&#39;t exist,
816 an attempt is made to create it with appropriate permissions. Do not specify a directory that is not on a
817 local filesystem! If you use the default directory (or another directory within <CODE>/tmp</CODE>),
818 <CODE>mod_fastcgi</CODE> will break if your system periodically deletes files from <CODE>/tmp</CODE>.
819 </P>
821 <STRONG>Windows NT:&nbsp;</STRONG> The <CODE>FastCgiIpcDir</CODE> directive specifies <EM>name</EM> as the
822 root for the named pipes used for communication between the application and the web server. The
823 <EM>name</EM> must be in the form of <STRONG>\\.\pipe\</STRONG><EM>pipename.</EM> The <EM>pipename</EM>
824 part can contain any character other than a backslash
825 </P>
827 The <CODE>FastCgiIpcDir</CODE> directive must precede any <A HREF=
828 "#FastCgiServer"><CODE>FastCgiServer</CODE></A> or <A HREF=
829 "#FastCgiExternalServer"><CODE>FastCgiExternalServer</CODE></A> directives (which make use of Unix
830 sockets). The directory must be readable, writeable, and executable (searchable) by the web server, but
831 otherwise should not be accessible to anyone.
832 </P>
833 <HR>
834 <H2>
835 <A NAME="FastCgiWrapper">FastCgiWrapper</A>
836 </H2>
837 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
838 <TABLE BORDER="0" SUMMARY="">
839 <TR>
840 <TD>
841 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
842 "Help"><STRONG>Syntax:</STRONG></A>
843 </TD>
844 <TD>
845 <CODE>FastCgiWrapper <EM>On | Off | filename</EM></CODE>
846 </TD>
847 </TR>
848 <TR>
849 <TD>
850 <A HREF=
851 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
852 </TD>
853 <TD>
854 <CODE>FastCgiWrapper Off</CODE>
855 </TD>
856 </TR>
857 <TR>
858 <TD>
859 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
860 "Help"><STRONG>Context:</STRONG></A>
861 </TD>
862 <TD>
863 server config
864 </TD>
865 </TR>
866 </TABLE>
868 The <CODE>FastCgiWrapper</CODE> directive is used to enable support for a wrapper such as <A HREF=
869 "http://httpd.apache.org/docs/suexec.html">suexec</A> (included with Apache in the support directory) or <A
870 HREF="http://cgiwrap.sourceforge.net/">cgiwrap</A>. To use the same wrapper used by Apache, set
871 <CODE>FastCgiWrapper</CODE> to <EM>On</EM> (NOTE - mod_fastcgi cannot reliably determine the wrapper used
872 by Apache when built as a DSO). The <EM>On</EM> argument requires suexec be enabled in Apache (for CGI). To
873 use a specific wrapper, specify a <EM>filename</EM>. If the filename does not begin with a slash (/) then
874 it is assumed to be relative to the <A HREF=
875 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>. The wrapper is used to invoke all
876 FastCGI applications (in the future this directive will have directory context).
877 </P>
879 When <CODE>FastCgiWrapper</CODE> is enabled, no assumptions are made about the target application and thus
880 presence and permissions checks cannot be made. This is the responsibility of the wrapper.
881 </P>
883 The wrapper is invoked with the following arguments: username, group, application. The username and group
884 are determined as described below. The application is the &quot;filename&quot; Apache resolves the
885 requested URI to (dynamic) or the filename provided as an argument to another FastCGI (server or
886 authorizer) directive. These arguments may or may not be used by the wrapper (e.g. suexec uses them,
887 cgiwrap parses the URI and ignores them). The environment passed to the wrapper is identical to the
888 environment passed when a wrapper is not in use.
889 </P>
891 When <CODE>FastCgiWrapper</CODE> is enabled, the location of static or external FastCGI application
892 directives can be important. They inherit their user and group from the <CODE>User</CODE> and
893 <CODE>Group</CODE> of the virtual server in which they were defined. <CODE>User</CODE> and
894 <CODE>Group</CODE> directives should precede FastCGI application definitions. Note that this does
895 <EM>not</EM> limit the FastCGI application to the virtual server in which they were defined, the
896 application is allowed to service requests from any virtual server with the same user and group. If a
897 request is received for a FastCGI application without an existing matching definition running with the
898 correct user and group, a dynamic instance of the application is started with the correct user and group.
899 This can lead to multiple copies of the same application running with different user/group. If this is a
900 problem, preclude navigation to the application from other virtual servers or configure the virtual servers
901 with the same User and Group.
902 </P>
904 See the Apache documentation for more information about suexec (make sure you fully understand the security
905 implications).
906 </P>
907 <HR>
908 <H2>
909 <A NAME="FastCgiAuthenticator">FastCgiAuthenticator</A>
910 </H2>
911 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
912 <TABLE BORDER="0" SUMMARY="">
913 <TR>
914 <TD>
915 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
916 "Help"><STRONG>Syntax:</STRONG></A>
917 </TD>
918 <TD>
919 <CODE>FastCgiAuthenticator <EM>filename</EM> [-compat]</CODE>
920 </TD>
921 </TR>
922 <TR>
923 <TD>
924 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
925 "Help"><STRONG>Context:</STRONG></A>
926 </TD>
927 <TD>
928 directory
929 </TD>
930 </TR>
931 </TABLE>
933 The <CODE>FastCgiAuthenticator</CODE> directive is used to define a FastCGI application as a per-directory
934 authenticator. Authenticators verify the requestor is who he says he is by matching the provided username
935 and password against a list or database of known users and passwords. FastCGI based authenticators are
936 useful primarily when the user database is maintained within an existing independent program or resides on
937 a machine other than the web server.
938 </P>
940 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
941 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
942 then it is assumed to be relative to the <A HREF=
943 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
944 </P>
946 <CODE>FastCgiAuthenticator</CODE> is used within <A HREF=
947 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
948 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers and must include
949 an <A HREF="http://httpd.apache.org/docs/mod/core.html#authtype"><CODE>AuthType</CODE></A> and <A HREF=
950 "http://httpd.apache.org/docs/mod/core.html#authname"><CODE>AuthName</CODE></A> directive. Only the
951 <CODE>Basic</CODE> user authentication type is supported. It must be accompanied by a <A HREF=
952 "http://httpd.apache.org/docs/mod/core.html#require"><CODE>require</CODE></A> or <CODE><A HREF=
953 "#FastCgiAuthorizer">FastCgiAuthorizer</A></CODE> directive in order to work correctly.
954 </P>
955 <BLOCKQUOTE>
956 <PRE>
957 &lt;Directory htdocs/protected&gt;
958 AuthType Basic
959 AuthName ProtectedRealm
960 FastCgiAuthenticator fcgi-bin/authenticator
961 require valid-user
962 &lt;/Directory&gt;
963 </PRE>
964 </BLOCKQUOTE>
966 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
967 CGI/FastCGI request handlers. All headers returned by a FastCGI authentication application in a successful
968 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
969 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
970 behavior can be obtained by using the <CODE>-compat</CODE> option.
971 </P>
973 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
974 &quot;AUTHENTICATOR&quot; to indicate which (Apache specific) authorizer phase is being performed.
975 </P>
977 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
978 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
979 FastCGI application can serve the document).
980 </P>
981 <HR>
982 <H2>
983 <A NAME="FastCgiAuthenticatorAuthoritative">FastCgiAuthenticatorAuthoritative</A>
984 </H2>
985 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
986 <TABLE BORDER="0" SUMMARY="">
987 <TR>
988 <TD>
989 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
990 "Help"><STRONG>Syntax:</STRONG></A>
991 </TD>
992 <TD>
993 <CODE>FastCgiAuthenticatorAuthoritative <EM>On | Off</EM></CODE>
994 </TD>
995 </TR>
996 <TR>
997 <TD>
998 <A HREF=
999 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1000 </TD>
1001 <TD>
1002 <CODE>FastCgiAuthenticatorAuthoritative On</CODE>
1003 </TD>
1004 </TR>
1005 <TR>
1006 <TD>
1007 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1008 "Help"><STRONG>Context:</STRONG></A>
1009 </TD>
1010 <TD>
1011 directory
1012 </TD>
1013 </TR>
1014 </TABLE>
1016 Setting the <CODE>FastCgiAuthenticatorAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1017 authentication to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1018 <CODE>modules.c</CODE> files) if the FastCGI application fails to authenticate the user.
1019 </P>
1021 A common use for this is in conjunction with a well protected <A HREF=
1022 "http://httpd.apache.org/docs/mod/mod_auth.html#authuserfile"><CODE>AuthUserFile</CODE></A> containing a
1023 few (administration related) users.
1024 </P>
1026 By default, control is not passed on and an unknown user will result in an Authorization Required reply.
1027 Disabling the default should be carefully considered.
1028 </P>
1029 <HR>
1030 <H2>
1031 <A NAME="FastCgiAuthorizer">FastCgiAuthorizer</A>
1032 </H2>
1033 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1034 <TABLE BORDER="0" SUMMARY="">
1035 <TR>
1036 <TD>
1037 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1038 "Help"><STRONG>Syntax:</STRONG></A>
1039 </TD>
1040 <TD>
1041 <CODE>FastCgiAuthorizer <EM>filename</EM> [-compat]</CODE>
1042 </TD>
1043 </TR>
1044 <TR>
1045 <TD>
1046 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1047 "Help"><STRONG>Context:</STRONG></A>
1048 </TD>
1049 <TD>
1050 directory
1051 </TD>
1052 </TR>
1053 </TABLE>
1055 The <CODE>FastCgiAuthorizer</CODE> directive is used to define a FastCGI application as a per-directory
1056 authorizer. Authorizers validate whether an authenticated requestor is allowed access to the requested
1057 resource. FastCGI based authorizers are useful primarily when there is a dynamic component to the
1058 authorization decision such as a time of day or whether or not the user has paid his bills.
1059 </P>
1061 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
1062 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
1063 then it is assumed to be relative to the <A HREF=
1064 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
1065 </P>
1067 <CODE>FastCgiAuthorizer</CODE> is used within <A HREF=
1068 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
1069 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers and must include
1070 an <A HREF="http://httpd.apache.org/docs/mod/core.html#authtype"><CODE>AuthType</CODE></A> and <A HREF=
1071 "http://httpd.apache.org/docs/mod/core.html#authname"><CODE>AuthName</CODE></A> directive. It must be
1072 accompanied by an authentication directive such as <A HREF=
1073 "#FastCgiAuthenticator"><CODE>FastCgiAuthenticator</CODE></A>, <A HREF=
1074 "http://httpd.apache.org/docs/mod/mod_auth.html#authuserfile"><CODE>AuthUserFile</CODE></A>, <A HREF=
1075 "http://httpd.apache.org/docs/mod/mod_auth_db.html#authdbuserfile"><CODE>AuthDBUserFile</CODE></A> or <A
1076 HREF="http://httpd.apache.org/docs/mod/mod_auth_dbm.html#authdbmuserfile"><CODE>AuthDBMUserFile</CODE></A>
1077 in order to work correctly.
1078 </P>
1079 <BLOCKQUOTE>
1080 <PRE>
1081 &lt;Directory htdocs/protected&gt;
1082 AuthType Basic
1083 AuthName ProtectedRealm
1084 AuthDBMUserFile conf/authentication-database
1085 FastCgiAuthorizer fcgi-bin/authorizer
1086 &lt;/Directory&gt;
1087 </PRE>
1088 </BLOCKQUOTE>
1090 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
1091 CGI/FastCGI request handlers. All headers returned by a FastCGI authorizer application in a successful
1092 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
1093 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
1094 behavior can be obtained by using the <CODE>-compat</CODE> option.
1095 </P>
1097 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
1098 &quot;AUTHORIZER&quot; to indicate which (Apache specific) authorizer phase is being performed.
1099 </P>
1101 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
1102 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
1103 FastCGI application can serve the document).
1104 </P>
1105 <HR>
1106 <H2>
1107 <A NAME="FastCgiAuthorizerAuthoritative">FastCgiAuthorizerAuthoritative</A>
1108 </H2>
1109 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1110 <TABLE BORDER="0" SUMMARY="">
1111 <TR>
1112 <TD>
1113 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1114 "Help"><STRONG>Syntax:</STRONG></A>
1115 </TD>
1116 <TD>
1117 <CODE>FastCgiAuthorizerAuthoritative <EM>On | Off</EM></CODE>
1118 </TD>
1119 </TR>
1120 <TR>
1121 <TD>
1122 <A HREF=
1123 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1124 </TD>
1125 <TD>
1126 <CODE>FastCgiAuthorizerAuthoritative On</CODE>
1127 </TD>
1128 </TR>
1129 <TR>
1130 <TD>
1131 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1132 "Help"><STRONG>Context:</STRONG></A>
1133 </TD>
1134 <TD>
1135 directory
1136 </TD>
1137 </TR>
1138 </TABLE>
1140 Setting the <CODE>FastCgiAuthorizerAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1141 authorization to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1142 <CODE>modules.c</CODE> files) if the FastCGI application fails to authorize the user.
1143 </P>
1145 By default, control is not passed on and an unauthorized user will result in an Authorization Required
1146 reply. Disabling the default should be carefully considered.
1147 </P>
1148 <HR>
1149 <H2>
1150 <A NAME="FastCgiAccessChecker">FastCgiAccessChecker</A>
1151 </H2>
1152 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1153 <TABLE BORDER="0" SUMMARY="">
1154 <TR>
1155 <TD>
1156 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1157 "Help"><STRONG>Syntax:</STRONG></A>
1158 </TD>
1159 <TD>
1160 <CODE>FastCgiAccessChecker <EM>filename</EM> [-compat]</CODE>
1161 </TD>
1162 </TR>
1163 <TR>
1164 <TD>
1165 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1166 "Help"><STRONG>Context:</STRONG></A>
1167 </TD>
1168 <TD>
1169 directory
1170 </TD>
1171 </TR>
1172 </TABLE>
1174 The <CODE>FastCgiAccessChecker</CODE> (suggestions for a better name are welcome) directive is used to
1175 define a FastCGI application as a per-directory access validator. The Apache Access phase precede user
1176 authentication and thus the decision to (dis)allow access to the requested resource is based on the HTTP
1177 headers submitted with the request. FastCGI based authorizers are useful primarily when there is a dynamic
1178 component to the access validation decision such as a time of day or whether or not a domain has paid his
1179 bills.
1180 </P>
1182 If the FastCGI application <EM>filename</EM> does not have a corresponding static or external server
1183 definition, it is started as a dynamic FastCGI application. If the filename does not begin with a slash (/)
1184 then it is assumed to be relative to the <A HREF=
1185 "http://httpd.apache.org/docs/mod/core.html#serverroot">ServerRoot</A>.
1186 </P>
1188 <CODE>FastCgiAccessChecker</CODE> is used within <A HREF=
1189 "http://httpd.apache.org/docs/mod/core.html#directory"><CODE>Directory</CODE></A> or <A HREF=
1190 "http://httpd.apache.org/docs/mod/core.html#location"><CODE>Location</CODE></A> containers.
1191 </P>
1192 <BLOCKQUOTE>
1193 <PRE>
1194 &lt;Directory htdocs/protected&gt;
1195 FastCgiAccessChecker fcgi-bin/access-checker
1196 &lt;/Directory&gt;
1197 </PRE>
1198 </BLOCKQUOTE>
1200 <CODE>mod_fastcgi</CODE> sends nearly all of the standard environment variables typically available to
1201 CGI/FastCGI request handlers. All headers returned by a FastCGI access-checker application in a successful
1202 response (Status: 200) are passed to sub-processes (CGI/FastCGI invocations) as environment variables. All
1203 headers returned in an unsuccessful response are passed on to the client. FastCGI specification compliant
1204 behavior can be obtained by using the <CODE>-compat</CODE> option.
1205 </P>
1207 <CODE>mod_fastcgi</CODE> sets the environment variable &quot;FCGI_APACHE_ROLE&quot; to
1208 &quot;ACCESS_CHECKER&quot; to indicate which (Apache specific) authorizer phase is being performed.
1209 </P>
1211 Custom failure responses from FastCGI authorizer applications are not (yet?) supported. See the <A HREF=
1212 "http://httpd.apache.org/docs/mod/core.html#errordocument">ErrorDocument</A> directive for a workaround (a
1213 FastCGI application can serve the document).
1214 </P>
1215 <HR>
1216 <H2>
1217 <A NAME="FastCgiAccessCheckerAuthoritative">FastCgiAccessCheckerAuthoritative</A>
1218 </H2>
1219 <!-- %plaintext &lt;?INDEX {\tt FastCgiConfig} directive&gt; -->
1220 <TABLE BORDER="0" SUMMARY="">
1221 <TR>
1222 <TD>
1223 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Syntax" REL=
1224 "Help"><STRONG>Syntax:</STRONG></A>
1225 </TD>
1226 <TD>
1227 <CODE>FastCgiAccessCheckerAuthoritative <EM>On | Off</EM></CODE>
1228 </TD>
1229 </TR>
1230 <TR>
1231 <TD>
1232 <A HREF=
1233 "http://httpd.apache.org/docs/mod/directive-dict.html#Default"><STRONG>Default:</STRONG></A>
1234 </TD>
1235 <TD>
1236 <CODE>FastCgiAccessCheckerAuthoritative On</CODE>
1237 </TD>
1238 </TR>
1239 <TR>
1240 <TD>
1241 <A HREF="http://httpd.apache.org/docs/mod/directive-dict.html#Context" REL=
1242 "Help"><STRONG>Context:</STRONG></A>
1243 </TD>
1244 <TD>
1245 directory
1246 </TD>
1247 </TR>
1248 </TABLE>
1250 Setting the <CODE>FastCgiAccessCheckerAuthoritative</CODE> directive explicitly to <EM>Off</EM> allows
1251 access checking to be passed on to lower level modules (as defined in the <CODE>Configuration</CODE> and
1252 <CODE>modules.c</CODE> files) if the FastCGI application fails to allow access.
1253 </P>
1255 By default, control is not passed on and a failed access check will result in a Forbidden reply. Disabling
1256 the default should be carefully considered.
1257 </P>
1258 <HR>
1259 <H3 CLASS="c3">
1260 <A HREF="http://www.FastCGI.com/">www.FastCGI.com</A>
1261 </H3>
1262 </BODY>
1263 </HTML>