# Fcgi.rb and lighttpd

**URL:** <https://www.ruby-forum.com/t/fcgi-rb-and-lighttpd/168272>\
**Category:** Ruby\
**Created:** [May 19, 2009, 1:40am UTC](https://www.ruby-forum.com/t/fcgi-rb-and-lighttpd/168272 "2009-05-19T01:40:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@Joel\_VanderWerf](https://www.ruby-forum.com/u/Joel_VanderWerf)\
**Post date:** [May 19, 2009, 1:40am UTC](https://www.ruby-forum.com/t/fcgi-rb-and-lighttpd/168272/1 "2009-05-19T01:40:55Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@Joel\_VanderWerf](https://www.ruby-forum.com/u/Joel_VanderWerf)\
**Post date:** [May 19, 2009, 11:42pm UTC](https://www.ruby-forum.com/t/fcgi-rb-and-lighttpd/168272/2 "2009-05-19T23:42:34Z")

</div>

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"
```
