FCGIWRAP(8)

πŸ“¦
version 1.1.0 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ FCGIWRAP ✨

okay bestie, this is the fcgiwrap page from the System Manager's Manual section 8, and it's lowkey one of the most useful little daemons ever. let's get into it πŸ’…


🌸 NAME 🌸

fcgiwrap β€” serve CGI applications over FastCGI. that's it, that's the whole job, and it does it beautifully ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

fcgiwrap [OPTIONS]

πŸ’– DESCRIPTION πŸ’–

so fcgiwrap is a simple server for running CGI applications over FastCGI. it's giving "small but mighty". it hopes to provide clean CGI support to Nginx (and honestly, to any other web servers that may need it too). no cap, it's just here to help 🫢


πŸŽ€ OPTIONS πŸŽ€

  • -c number β€” how many fcgiwrap processes you wanna prefork. yes queen, parallelism πŸ’…
  • -f β€” redirect STDERR output from the executed CGI through FastCGI so it actually shows up in the web server error log. otherwise it would get returned on fcgiwrap's own STDERR, which could be redirected (πŸ™ˆ bye bye, output). and if you're running through spawn-fcgi, fcgiwrap's STDERR is sent to /dev/null, so this option is literally the way to get that output back. iconic rescue mission 🦸
  • -s socket_url β€” a URL for the listen socket to bind to. by default fcgiwrap expects a listen socket to be passed on file descriptor 0, matching the FastCGI convention. the recommended way to deploy fcgiwrap is to run it under a process manager that takes care of opening the socket for you (very main character energy, letting someone else handle the socket). however, for simple configurations and one-off tests, this option may be used. valid *socket_url*s include unix:/path/to/unix/socket, tcp:dot.ted.qu.ad:port and tcp6:[ipv6_addr]:port ⭐
  • -h β€” show a help message and exit. a little "hi, here's what I do" moment πŸ’–

🌈 ENVIRONMENT 🌈

when it's 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 gets run as a 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. periodt. πŸ”₯

  • 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
  • NO_BUFFERING β€” when set (e.g., to ""), disables output buffering

🧚 EXAMPLE 🧚

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. slay πŸ’…

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;
}

πŸ‘‘ AUTHOR πŸ‘‘

fcgiwrap was written by Grzegorz Nosek <root@localdomain.pl> with contributions by W-Mark Kubacki <wmark@hurrikane.de>. absolute legends 🫢

this manual page was written by Jordi Mallach <jordi@debian.org> (with contributions by Grzegorz Nosek) for the Debian project (and may be used by others). iykyk πŸ’œ


and that's the whole vibe check, bestie β€” this page is from Jun 3, 2010, manual section FCGIWRAP(8), straight out of the System Manager's Manual. go forth and serve some CGI πŸ’–βœ¨πŸŽ€πŸ¦‹