fcgi.rb and lighttpd

J

Joel VanderWerf

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...
 
J

Joel VanderWerf

Joel said:
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"
))
)

For posterity:

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

"check-local" => "disable"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top