Lighttpd + FCGI + Perl, anyone?

Toby Corkindale tjc at wintrmute.net
Sat Jul 12 07:02:46 BST 2008


On Sat, Jul 12, 2008 at 03:59:30PM +1000, Toby Corkindale wrote:
> On Fri, Jul 11, 2008 at 06:29:47PM +0100, Iain Barnett wrote:
> > I'm trying to get the above setup to work, but I've found a big fat zero 
> > when it comes to useful info on how to do this with perl. The php and ruby 
> > crowd have got endless examples! (perhaps mongers are just seen as more 
> > resourceful?)
> >
> > If anyone has managed this, I'm most interested in what the fastcgi.server 
> > part of the lighttpd.conf looks like, as this is the most fatty part of the 
> > "big fat zero".
> 
> This works for me: (where the eventbot.fcgi is an auto-generated script
> produced by Catalyst's build process).
[snip]

My example will run the fastcgi scripts locally, under the uid of lighttpd.
It's a simple but easy to get going method.

For better practice, though, I recommend you have multiple application servers,
each running standalone fastcgi-based applications over sockets or tcp/ip.
Then configure lighttpd to connect to all the app servers and loadbalance on
them.

You'll get better memory usage that way, as you're taking advantage of the
application starting up, then forking.. whereas the simple "run from lighty"
method runs a whole new process each time it starts another child.

> $HTTP["host"] =~ "(www\.)?eventbot.dryft.net$" {
>     fastcgi.server = (
>         "" => (
>             "eventbot" => (
>                 "socket" => "/tmp/eventbot-fcgi.sock",
>                 "max-procs" => 2,
>                 "check-local" => "disable",
>                 "bin-path" => "/var/www/eventbot/cgi-bin/eventbot.fcgi"
>             )
>         )
>     )
> }


More information about the london.pm mailing list