Rack, FastCGI, Lighttpd configuration

Posted by zacsek on Stack Overflow See other posts from Stack Overflow or by zacsek
Published on 2010-06-11T13:05:31Z Indexed on 2010/06/13 16:02 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

Hi!

I want to run a simple application using Rack, FastCGI and Lighttpd, but I cannot get it working.

I get the following error:

/usr/lib/ruby/1.8/rack/handler/fastcgi.rb:23:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/rack/handler/fastcgi.rb:23:in `new'
from /usr/lib/ruby/1.8/rack/handler/fastcgi.rb:23:in `run'
from /www/test.rb:7

Here is the application:

#!/usr/bin/ruby
app = Proc.new do |env|
        [200, {'Content-Type' => 'text/plain'}, "Hello World!"]
end

require 'rack'
Rack::Handler::FastCGI.run app, :Port => 4000

... and the lighttpd.conf:

server.modules   += ( "mod_access", "mod_accesslog", "mod_fastcgi" )

server.port = 80
server.document-root = "/www"

mimetype.assign = (
  ".html" => "text/html",
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)

index-file.names = ( "test.rb" )

fastcgi.debug = 1
fastcgi.server    = ( ".rb" =>
                ((
                  "host" => "127.0.0.1",
                  "port" => 4000,
                  "bin-path" => "/www/test.rb",
                  "check-local" => "disable",
                  "max-procs" => 1
             ))
            )

Can someone help me? What am I doing wrong?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about fastcgi