The FastCGI plug-in provides the following Server Application Functions (SAFs):
The various parameters and error-reason strings for the FastCGI SAFs are described in the following sections:
The auth-fastcgi SAF is used in a PathCheck directive. This SAF is used to specify the FastCGI server application to be used for authorization.
The auth-fastcgi PathCheck SAF sends the request to the specified Authorizer FastCGI application. If the application has returned a status code of 200, the authorization has succeeded and the Web Server proceeds with request execution. Otherwise, the response that was sent by the FastCGI application is sent back to the user-agent.
The auth-fastcgi SAF is optional and should only be used to forward the requests to an authorizer FastCGI application.
For a list of parameters accepted by auth-fastcgi SAF, see FastCGI SAF Parameters.
The following obj.conf code example demonstrates the use of auth-fastcgi:
PathCheck fn="auth-fastcgi" app-path="/foo/bin/php" bind-path="fooUDS"
On the first request to the auth-fastcgi, FastCGI plug-in creates the FastCGI authorizer application processes and sends the request for evaluation.
The responder-fastcgi SAF forwards a request to a FastCGI application that acts as a Responder, for further processing. responder-fastcgi sends the request data to the listener onto which the app-path application processes are listening. Once the application responds to the request, service-fastcgi process is the response headers before sending them back to the user-agent.
For a list of parameters accepted by responder-fastcgi SAF, see FastCGI SAF Parameters.
The following obj.conf code example demonstrates the use of responder-fastcgi:
Service fn="responder-fastcgi" app-path="/foo/bin/perl" bind-path="fooPerl"
The filter-fastcgi SAF forwards a request to a FastCGI application that acts as a Filter, for further processing. A filter application receives the information associated with an HTTP request plus additional data from a file stored on the server, and generates a filtered version of the data stream as the response.
filter-fastcgi sends the request data in FastCGI record format to the application specified by app-path. Once the application responds to the request, filter-fastcgi process is the response headers before sending them to the user-agent.
For a list of parameters accepted by filter-fastcgi SAF, see FastCGI SAF Parameters.
The following obj.conf code example demonstrates the use of filter-fastcgi:
Service type="magnus-internal/perl" fn="filter-fastcgi" app-path="/foo/bin/perl" bind-path="fooPerl"
The error-fastcgi SAF is called when the FastCGI plug-in encounters an error. This is used to display a specified page or URL.
For a list of parameters accepted by error-fastcgi SAF, see FastCGI SAF Parameters.
The following obj.conf snippet demonstrates the use of error-fastcgi:
Error fn="error-fastcgi" error-reason="Fastcgi Connection Error" error-url="http://www.foo.com/errorPage1.html"
FastCGI plug-in SAFs auth-fastcgi and responder-fastcgi both accept the following parameters unless otherwise mentioned explicitly:
Parameters chroot, user, group and nice are applicable to only UNIX platforms. On Windows platforms, these parameters are ignored.
app-path - (Optional) FastCGI server application path that processes the request. The functionality is dependent on the value of the “bind-path“ as follows:
If only app-path is specified, the plug-in will create FastCGI server application. This server application will listen to UNIX Domain Sockets created by the plug-in.
If both app-path and bind-path are specified, the plug-in will create FastCGI server applications. This server application will listen to the TCP/IP address and port value specified in bind-path or UNIX Domain Sockets created by the FastCGI plug-in.
If only bind-path is specified, the plug-in will directly communicate with the FastCGI server application.
If both app-path and bind-path are not specified, then the plug-in will log an error message.
app-args — (Optional) Values that are passed as the arguments to the FastCGI application process. Multiple app-args parameters are allowed. The format for the multiple app-args parameters is:
app-args="value" app-args="value" ..
bind-path - (Optional) Can be a UNIX Domain Socket (UDS) name or of the form host:port. The description of app-path parameter explains the usage of bind-path parameter. Note that the UDS name is applicable only on UNIX platforms; on Windows platforms, bind-path must be specified as host:port.
min-procs - (Optional) Integer specifying the minimum number of FastCGI application processes to be created. Defaults to 1.
max-procs - (Optional) Integer specifying the maximum number of FastCGI application processes that could be created at any time. It should be equal to or greater than min-procs. Defaults to 1.
chroot - (Optional) Used to set the root directory of the chroot jail that the FastCGI server application runs in. Defaults to the server's root directory.
user - (Optional) Specifies the user ID the FastCGI server application runs as. Defaults to server's user ID.
group - (Optional) The FastCGI server application would be running under the specified group. Defaults to server's group.
nice - (Optional) Specifies the nice value of FastCGI server application processes.
listen-queue - (Optional) Integer specifying the listen queue size for the socket. Defaults to 20.
app-env - (Optional) Value pairs which will be passed as environment variables to the FastCGI server application process. Multiple app-env parameters are allowed. The format for multiple app-env parameters is:
app-env="name=value" app-env="name=value"....
reuse-connection - (Optional) Boolean value that determines if connections to FastCGI server applications are reused. False (0, false, no) indicates that the connections to FastCGI server applications are closed after each request. True (1, true, yes) indicates that existing connections are reused for new requests. See also connection-timeout.
connection-timeout - (Optional) If reuse-connection is true, this value specifies the timeout value in seconds for the pooled connections. If a connection is idle for the specified amount period of time, the plug-in closes the connection. See also reuse-connection .
resp-timeout - (Optional) Integer representing the FastCGI server response timeout in seconds. If there is no response from the FastCGI server application within the specified period of time, the request is discarded.
restart-interval - (Optional) Integer representing the time interval (in minutes) after which the FastCGI server application is restarted. Defaults to 60 minutes (1 hour).
req-retry - (Optional) Integer representing the number of times the plug-in should resend the request when the FastCGI server application rejects the request.
The error-fastcgi SAF accepts the following parameters:
error-url - Specifies the page, URI or URL to be displayed in case a failure or error occurs. The value of this parameter can be an absolute path, a path relative to docroot, or an URL or URI.
error-reason - (Optional) String representing the FastCGI protocol error. This is used to differentiate error URLs to be displayed, in case of any plug-in errors.
Here is the list of valid error-reason strings:
Missing Parameters : whenever app-path and bind-path are not specified.
“Stub Start Error” : unable to start the stub for various reasons like fork failure, bind error, listen error.
“Stub Connection Failure” : client socket creation or connect failure.
“No Permission” : stub executable has no exec permission, stat failure, and so on.
“Stub Request Handling Error” : unable to send the request to stub, received invalid/no response from the stub for a request, and so on.
“Set Parameter Failure” : when set user, group, chroot, nice (and so on) fail.
“Invalid user and/or group” : when user and/or group is invalid.
“Invalid Parameters” : when invalid nice value is specified.
“Server Process Creation Failure” : application fork failure, application exec failure, bind error, listen error, and so on.
“Fastcgi Protocol Error” : invlid record version, invalid record type, unkown role, and so on.
“Internal Error” : unable to open the file to be sent to the filter application, any other unknown errors.