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