Actions
Howto CGI¶
lighttpd 2.0 doesn't support running cgi scripts/binaries directly (it is a "non-forking" webserver); so you need a FastCGI wrapper around your CGI applications (sometimes you just don't want or can't convert them to real FastCGI applicatons).
One wrapper for this is http://redmine.lighttpd.net/projects/fcgi-cgi/repository.
Lighttpd config¶
Just forward cgi requests to your FastCGI wrapper:
setup { module.load ( "mod_fastcgi" ); } alias ("/cgi-bin/" => "/usr/lib/cgi-bin"); if req.path =^ "/cgi-bin" { index ( "index.cgi", "index.pl", "index.html" ); if phys.path =~ "\.(cgi|pl)$" { if phys.is_file { fastcgi "unix:/var/run/lighttpd/sockets/www-cgi.sock"; } } }
Spawn the FastCGI CGI wrapper¶
Simple ./run script to spawn rails applications with spawn-fcgi and runit/daemontools:
#!/bin/sh exec 2>&1 exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/sockets/www-cgi.sock -u nobody -U www-data -- /usr/bin/fcgi-cgi
Updated by simmel over 11 years ago · 3 revisions