Forum: Ruby on Rails Lighttpd and fastcgi problems...

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ben R. (Guest)
on 2006-03-02 19:31

I'm having difficulty getting ruby running via Lighttpd and fastcgi. My
lighttpd.conf reads:

server.port = 81 = "/tmp/"

server.modules = ( "mod_redirect", "mod_access", "mod_fastcgi",
"mod_accesslog", "mod_simple_vhost" )

server.document-root = "/tmp/mis/public"
server.indexfiles = ( "index.html" )
server.error-handler-404 = "/dispatch.fcgi"
accesslog.filename = "/var/log/lighttpd/access_log"
server.errorlog = "/var/log/lighttpd/error_log"

fastcgi.server =  (".fcgi" => ( "staging" =>
  ( "min-procs" => 1,
    "max-procs" => 5,
    "socket" => "/tmp/ruby-railsapp.fastcgi",
    "bin-path" => "/tmp/mis/public/dispatch.fcgi"

It serves HTML pages just fine, but when I try and do something ruby, I
get the following trace:

2006-03-02 17:03:50: (mod_fastcgi.c.1690) connect failed: Connection
refused 0 /tmp/ruby-railsapp.fastcgi-1
2006-03-02 17:03:50: (mod_fastcgi.c.1690) connect failed: Connection
refused 0 /tmp/ruby-railsapp.fastcgi-0
2006-03-02 17:03:51: (mod_fastcgi.c.2381) unexpected end-of-file
(perhaps the fastcgi process died): pid: 30409 socket:
/tmp/ruby-railsapp.fastcgi-0 host:  port: 0
2006-03-02 17:03:51: (mod_fastcgi.c.3283) response not received, request
sent: 979 connection-fd: 6 fcgi-fd: 7

Running ls /tmp gives me:

ls /tmp/
ruby-railsapp.fastcgi-0  ruby-railsapp.fastcgi-1
ruby-railsapp.fastcgi-2  ruby-railsapp.fastcgi-3

I've run out of googling at this point. Can anyone help? I'm running on
Fedora Core 3 with the latest version of lighttpd:
/usr/local/sbin/lighttpd -v
lighttpd-1.4.10 - a light and fast webserver
Build-Date: Mar  2 2006 16:34:03

and ruby:
ruby -v
ruby 1.8.4 (2005-12-24) [i386-linux]

Greg F. (Guest)
on 2006-03-02 19:38
(Received via mailing list)
On 3/2/06, Ben R. <removed_email_address@domain.invalid> wrote:
> Hi,
> I'm having difficulty getting ruby running via Lighttpd and fastcgi. My
> lighttpd.conf reads:

A quick cut and paste from an e-mail I posted a couple of hours ago (I
did edit it a little to remove some of the old non-elevant context):

Until you get dispatch.fcgi to properly fail in the absense of a
webserver I would not even experiment with the webserver.

Try to stop all apache / lighttpd webserver instances and then run
"ruby dispatch.fcgi".

AIUI, dispatch.fcgi should be attempting to connect to a socket that
is provided by the now non-existent webserver.  Since the socket does
not have a listener it should error out with the "Error 500: Internal
Server Error" message.

If dispatch.fcgi is simply exiting with no error message you still
have something wrong in your fcgi setup that has nothing to do with

At that point you will need to be posting what env. (OS, distro, etc.)
you are working with and what you did to get your fcgi setup going.
Getting fcgi setup seems to be very specific to the OS and distro.  I
have only set it up once and that is on a Suse 10.0 setup, so I'm not
sure I'm the one to help.

FYI: AIUI, when things are working the webserver creates the sockets
and establishes listens on them.  Then the fcgi processes are started
by the webserver in the background.  They in turn connect to the
sockets.  The fcgi processes should be long lived (hours/days/weeks)
and able to handle repeated requests for fcgi service from the

Greg F.
The Norcross Group
Forensics for the 21st Century
unknown (Guest)
on 2006-03-02 21:31
(Received via mailing list)
In rails edge, changeset 3745 seems to have caused me some issues within

75: connection.verify!(@@connection_cache_timeout)

is giving me grief because I presume I am supposed to have
@@connection_cache_timeout set somewhere.

The latest was checked in today, and I don't see any other reference of
@@connection_cachce_timeout anywhere.

Does anyone have any ideas?

Cheers, Simon.
Ben R. (Guest)
on 2006-03-03 00:55
Well, I think I figured out my problem; I needed to install
ruby-fcgi-0.8.6 with the parameters:

ruby install.rb config -- --with-fcgi-include=/usr/local/include

as described in the README, then things started to work.
Stephen B. (Guest)
on 2006-03-07 20:48
(Received via mailing list)

I have lightpd running behind an apache proxy and I would like to
setup lighttpd so that different folders under webroot are mapped to
different rails applications.

filesystem view:


urlview: => railsapp1 => railsapp2

and => index.html in webroot/

Peter E. (Guest)
on 2006-03-07 20:51
(Received via mailing list)
see that page:

and search for keywords 'virtual' and 'host'
Stephen B. (Guest)
on 2006-03-07 21:34
(Received via mailing list)
Thanks Peter,

As I read that page virtual hosting maps hostnames => document roots
(using server-root, default-host, and document-root) -- there does not
appear to be a way to map hostname/path1 to a virtual host.

In order to server two different rails apps I assume that I need to
create two different fcgi.server blocks in lighttpd.conf however these
blocks appear to be differentiated based on hostname and port alone.

I can easily map to an fcgi process that starts
either the dispatch.fcgi process in railsapp1 or raqilsapp2.

If I had more control over the name I could create
virtual hosts like this:

and then create two virtual hosts and two fcgi-server blocks for both
the apps.

But I am stuck with

Perhaps I am missing something obvious ...?

>> Datum: Tue, 7 Mar 2006 13:45:08 -0500
>>    railsapp1/
>> urlview:
>> - Stephen B.
>>    Concord Consortium,
>> _______________________________________________
>> Rails mailing list
>> removed_email_address@domain.invalid
>Rails mailing list


-- Stephen B.
   Director of Technology, Concord Consortium
   10 Concord Crossing, Suite 300, Concord, MA 01742
   direct and fax: 978 405-3209 main: 978 405 3200  mailto:removed_email_address@domain.invalid
This topic is locked and can not be replied to.