FastCGI

FastCGI is a binary protocol that multiplexes requests over a single connection.

VSGI uses FastCGI bindings under the hood to provide a compliant implementation. See Installation for more information about the framework dependencies.

The whole request cycle is processed in a thread and dispatched in the main context, so it’s absolutely safe to use shared states.

Options

Option Default Description
--port none listen on a TCP port from local interface
--socket none listen on a UNIX socket path
--file-descriptor 0 listen to the provided file descriptor
--backlog 10 connection queue depth in the listen call

Only one option from --port, --socket and --file-descriptor can be specified.

By default, the FastCGI implementation listens on the file descriptor 0, which is conventionally the case when the process is spawned by an HTTP server.

lighttpd

lighttpd can be used to develop and potentially deploy your application. An example of configuration file is available in the fastcgi example folder.

You can run the FastCGI example with lighttpd:

./waf configure --enable-examples && ./waf build
lighttpd -D -f examples/fastcgi/lighttpd.conf

Apache

Under Apache, there are two mods available: mod_fcgid is more likely to be available as it is part of Apache and mod_fastcgi is developed by those who did the FastCGI specifications.

Nginx

Nginx expect a process to be already spawned and will communicate with it using a TCP port or a socket path. Read more about ngx_http_fastcgi_module.

You can spawn a process with spawn-fcgi, an utility part of lighttpd.