Nginx SCGI module
- Note
- This is a copy of the page at http://hg.mperillo.ath.cx/nginx/mod_scgi/file/tip/README, it might be more up to date than this copy.
Introduction
mod_scgi is an implementation of the Simple Common Gateway Interface for the Nginx web server.
Installation
mod_scgi has been tested with Nginx 0.5.35.
Download the Nginx sources from http://nginx.net/ and unpack it.
The sources of mod_scgi can be downloaded from a Mercurial repository: http://hg.mperillo.ath.cx/nginx/mod_scgi/
At the moment there is no stable release, so you need to download the latest revision (tip) or the latest tag.
The tip can be downloaded via the Mercurial web interface: http://hg.mperillo.ath.cx/nginx/mod_scgi/archive/tip.tar.gz
or cloning the repository:
hg clone http://hg.mperillo.ath.cx/nginx/mod_scgi/
The latest tag can be found from: http://hg.mperillo.ath.cx/nginx/mod_scgi/tags
To build Nginx, change to the directory which contains the Nginx sources, and run the configuration script making sure to add the path to the mod_scgi sources using the --add-module option. It is recommended to enable debugging.
$ ./configure --add-module=/path/to/mod_scgi/ --with-debug
Nginx will use as default prefix path the directory /usr/local/nginx.
Now you can build and install the software:
$ make
and as root:
$ make install
Notes
This module is still under development.
The module is mainly an adaptation of the existing ngx_http_fastcgi_module, with some code (the HTTP status line and headers parsing) from the ngx_http_proxy_module.
In the current version SCRIPT_NAME and PATH_INFO are not defined.
The current implementation only supports SCGI response that use what CGI calls "Non-Parsed Header Output".
CGI, instead, requires an implementation to support the "Parsed Header Output", and many applications use this format.
See http://ken.coar.org/cgi/cgi-120-00a.html#ISSUE-001 for more details.
BUGS
This implementation is not fully conform to the SCGI protocol.
The SCGI specification states:
Duplicate names are not allowed in the headers
however Nginx does not combines multiple headers.
Example
Here is a sample configuration:
location /scgi {
scgi_pass 127.0.0.1:4000;
include conf/scgi_vars;
scgi_var SCRIPT_NAME /scgi;
scgi_var PATH_INFO /xxx;
}note the inclusion of the conf/scgi_vars file.
This file must be copied to the nginx $prefix/conf directory by hand.
