FAQ

Page Discussion Edit History

ThttpdCGI

Nginx doesn't serve CGI scripts. While there's all sorts of hacks to work around this, none of them are really satisfactory or general-purpose.

Thttpd is a *very* simple (and very small footprint) HTTP server that includes CGI support. It's a good solution if you need CGI support. Simply proxy to it from Nginx for all your CGI needs.

If you decide to go this route, you should probably build thttpd from source and apply the patch found here.

/etc/thttpd.conf (this is just an example):

# BEWARE : No empty lines are allowed!
# This section overrides defaults
# This section _documents_ defaults in effect
# port=80
# nosymlink         # default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
host=127.0.0.1
port=8000
user=thttpd
logfile=/var/log/thttpd.log
pidfile=/var/run/thttpd.pid
dir=/var/www
cgipat=**.cgi|**.pl

For a more detailed example, see the Mailman entry on the Nginx wiki.

/etc/nginx.conf:

location /cgi-bin {
   include proxy.conf;
   proxy_pass http://127.0.0.1:8000;
}