fcgiwrap8
Serve cgi applications over fastcgi
Usage
fcgiwrap [OPTIONS]
Overview
fcgiwrap is a simple server for running CGI applications over FastCGI. It hopes to provide clean CGI support to Nginx (and other web servers that may need it).
Options
-
-c number -
Number of fcgiwrap processes to prefork.
-
-f -
Redirect STDERR output from executed CGI through FastCGI so it shows in the web server error log. Otherwise it would be returned on
fcgiwrap's STDERR, which could be redirected. If running throughspawn-fcgi,fcgiwrap's STDERR is sent to /dev/null, so this option provides a way to get that output back.
-
-s socket_url -
A URL for the listen socket to bind to. By default
fcgiwrapexpects a listen socket to be passed on file descriptor 0, matching the FastCGI convention. The recommended way to deployfcgiwrapis to run it under a process manager that takes care of opening the socket. However, for simple configurations and one-off tests this option may be used. Valid socket_urls include unix:/path/to/unix/socket, tcp:dot.ted.qu.ad:port and tcp6:[ipv6_addr]:port.
-
-h -
Show a help message and exit.
Environment
When running, fcgiwrap evaluates these environment variables set by the web server calling an fcgi-script. The variables DOCUMENT_ROOT and SCRIPT_NAME will be concatenated and the resulting executable run as CGI script wrapped as FastCGI, with the remainder after the script name available as PATH_INFO. To disable PATH_INFO mangling, set up your web server to pass SCRIPT_FILENAME, which should contain the complete path to the script. Then PATH_INFO will not be modified.
DOCUMENT_ROOT
directory which the script resides in
SCRIPT_NAME
actual executable
SCRIPT_FILENAME
complete path to CGI script. When set, overrides DOCUMENT_ROOT and SCRIPT_NAME
Examples
The fastest way to see fcgiwrap do something is to launch it at the command line like this:
fcgiwrap -s unix:/var/run/fcgiwrap.sock
Apart from potential permission problems etc., it should be ready to accept FastCGI requests and run CGI scripts.
Most probably you will want to launch fcgiwrap by spawn-fcgi using a configuration like this:
FCGI_SOCKET=/var/run/fcgiwrap.sock
FCGI_PROGRAM=/usr/sbin/fcgiwrap
FCGI_USER=nginx
FCGI_GROUP=www
FCGI_EXTRA_OPTIONS="-M 0700"
ALLOWED_ENV="PATH"
Nginx can be configured to have the arbitrary CGI cgit run as FastCGI as follows:
location / {
fastcgi_param DOCUMENT_ROOT /var/www/localhost/htdocs/cgit/;
fastcgi_param SCRIPT_NAME cgit;
fastcgi_pass unix:/var/run/fastcgi.sock;
}
Releases
9 releases since Debian 6.0 (Squeeze); the text changed 4 times.
-f since Debian 8 (Jessie);
-s since Debian 7 (Wheezy).