Monkey Server v1.6

CGI - Common Gateway Interface

The CGI (Common Gateway Interface) allows to interact with a third party program that process a HTTP request and generate content on the fly. This is the old-fashion mechanism to run programs through a HTTP server.

When a program runs using the CGI interface, the server will spawn a new process to make the script run on new environment, this is a known major performance issue of CGI.

Note: If your server requires to achieve high performance, is suggested to use the FastCGI interface instead of the old-fashion CGI.

Enable Plugin

If the plugin have not been built in static mode (check with '$ monkey -b'), you can enable the CGI plugin through the following the steps mentioned on Plugins section. The plugin name is monkey-cgi.so, so make sure the plugin entry is Load and the absolute path is correct.

Configuring

The CGI plugin is a handler, for hence it needs to be enabled on the Virtual Host definition under the HANDLERS sections through a Match rule. The following example will define a Handler rule to make the CGI plugin process all incoming request that ends in .cgi:

[HANDLERS]
    Match  /.*\.cgi  cgi

Optionally, the CGI plugin support an extra parameter into the Match rule to specify an interpreter, e.g:

[HANDLERS]
    Match  /.*\.cgi  cgi  /bin/bash

This last parameter is optional and is useful for cases for content that needs to be interpreted by Perl, Python, PHP-cli or other.