How does lighttpd/fcgi/rails work?

I’m trying to understand how the lighttpd/fcgi/rails process works. It
seems like there are two ways to start lighttpd for:

  1. script/server (only starts lighttpd if you have lighttpd in your
    $PATH,
    otherwise starts webrick)

  2. lighttpd -f /path/to/lighttpd.conf

It seems like #1 is for development and #2 is for production, but I
don’t
actually know what the difference between the two is. I think in either
case, somebody stop me if I’m wrong, there will be a lighttpd process
running and a ruby process running (which is rails). The lighttpd
process
talks to the ruby process using fcgi. Is that correct? And is that
also
the case with method #1?

In method #2, how does the ruby process get started? By lighttpd?

And for extra credit, how does it work if you use Apache/fcgi, same as
#2?

Dave T., if you’re listening, it would be great if the Deployment
section of AWDwR2 included this :slight_smile: