Forum: Ruby fcgi.rb and lighttpd

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.
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-05-19 01:40
(Received via mailing list)
I'm trying to get ruby code to listen to fastcgi from lighttpd... should
be easy, but ...

The symptom: My ruby program is started up by lighttpd (4 instances, in
fact), but it never gets requests.

The lighttpd config is:

   server.modules   += ( "mod_fastcgi" )

   fastcgi.debug = 1

   fastcgi.server    = ( "/test/" =>
           ((
                   "bin-path" => "/home/vjoel/simple.rb",
                   "socket" => "/tmp/ruby.socket"
           ))
   )

(I've also tried using ".rb" in place of "/test/".)

The ruby side is adapted from the fcgi documentation:

   #!/usr/bin/env ruby

   require "fcgi"

   File.open("/tmp/simple1.log", "a") {|f| f.puts "step 1"}

   FCGI.each {|request|
     File.open("/tmp/simple2.log", "a") {|f| f.puts "step 2"}

     out = request.out
     out.print "Content-Type: text/plain\r\n"
     out.print "\r\n"
     out.print Time.now.to_s
     request.finish
   }

The "step 1" is written 4 times, as expected, when lighttpd starts. So
lighttpd is aware of fastcgi, and the fcgi.so lib is loading correctly,
as is my simple.rb.

Lighttpd is listening at localhost:80, which is easily verified. (I get
the placeholder page because I have put nothing there.)

However, when I browse to localhost:80/test/something, I get a 404, and
the "step 2" is never written.

All that shows up in the lighttpd log is: the "starting" message, and
the four spawning messages, like this one:

2009-05-18 16:12:44: (mod_fastcgi.c.1332) --- fastcgi spawning
         port: 0
         socket /tmp/ruby.socket
         current: 3 / 4

I feel as if I'm missing something obvious...
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-05-19 23:42
(Received via mailing list)
Joel VanderWerf wrote:
>
>   fastcgi.debug = 1
>
>   fastcgi.server    = ( "/test/" =>
>           ((
>                   "bin-path" => "/home/vjoel/simple.rb",
>                   "socket" => "/tmp/ruby.socket"
>           ))
>   )

For posterity:

Someone on the lighttpd forum pointed out that the fastcgi.server config
needs this line:

                 "check-local" => "disable"
This topic is locked and can not be replied to.