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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7a5582a8d74a4b9745b7278aa8a35ce6?d=identicon&s=25 Ben Rometsch (dabeeeenster)
on 2006-03-02 18:31
Hi,

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

server.port = 81
server.pid-file = "/tmp/test_lighttpd.pid"

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
ruby-railsapp.fastcgi-4  test_lighttpd.pid

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]

Thanks,
Ben
25bbc96d9c53647354cb724e744b2222?d=identicon&s=25 Greg Freemyer (Guest)
on 2006-03-02 18:38
(Received via mailing list)
On 3/2/06, Ben Rometsch <ben@solidstategroup.com> wrote:
> Hi,
>
> I'm having difficulty getting ruby running via Lighttpd and fastcgi. My
> lighttpd.conf reads:
Ben

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
apache/lighttpd.

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
webserver.
===

HTH
Greg
--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
554360931c4b622504bb77d9df79832b?d=identicon&s=25 unknown (Guest)
on 2006-03-02 20:31
(Received via mailing list)
In rails edge, changeset 3745 seems to have caused me some issues within
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb

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.
7a5582a8d74a4b9745b7278aa8a35ce6?d=identicon&s=25 Ben Rometsch (dabeeeenster)
on 2006-03-02 23: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
--with-fcgi-lib=/usr/local/lib

as described in the README, then things started to work.
5810a1b7743eb2186ca0ea1d0a3469a0?d=identicon&s=25 Stephen Bannasch (Guest)
on 2006-03-07 19:48
(Received via mailing list)
Question:

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:

webroot/
   railsapp1/
     app/
     config/
     public/
     [...]
   railsapp2/
     app/
     config/
     public/
     [...]

urlview:

   rails.dev.host.com/railsapp1 => railsapp1
   rails.dev.host.com/railsapp2 => railsapp2

and

   rails.dev.host.com => index.html in webroot/

Thanks
36958dd94ca666a38483df282a5214d5?d=identicon&s=25 Peter Ertl (Guest)
on 2006-03-07 19:51
(Received via mailing list)
see that page:
http://www.lighttpd.net/documentation/

and search for keywords 'virtual' and 'host'
5810a1b7743eb2186ca0ea1d0a3469a0?d=identicon&s=25 Stephen Bannasch (Guest)
on 2006-03-07 20: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 rails.dev.host.com to an fcgi process that starts
either the dispatch.fcgi process in railsapp1 or raqilsapp2.

If I had more control over the name rails.dev.host.com I could create
virtual hosts like this:

  railsapp1.rails.dev.host.com
  railsapp2.rails.dev.host.com

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

But I am stuck with rails.dev.host.com

Perhaps I am missing something obvious ...?

>> Datum: Tue, 7 Mar 2006 13:45:08 -0500
>>    railsapp1/
>> urlview:
>> - Stephen Bannasch
>>    Concord Consortium, http://www.concord.org
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails


--

-- Stephen Bannasch
   Director of Technology, Concord Consortium
   10 Concord Crossing, Suite 300, Concord, MA 01742
   direct and fax: 978 405-3209 main: 978 405 3200
   http://www.concord.org  mailto:stephen@concord.org
This topic is locked and can not be replied to.