2010-06-11 10 views
1

Je veux exécuter une application simple en utilisant Rack, FastCGI et Lighttpd, mais je ne peux pas le faire fonctionner.Rack, FastCGI, configuration Lighttpd

je reçois l'erreur suivante:

/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 

Voici l'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 

... et le 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 
      )) 
      ) 

quelqu'un peut me aider? Qu'est-ce que je fais mal?

Répondre

2

Vous avez déjà exécuté un processus sur le port 80 ou 4000, vérifiez avec la commande netstat -anp.

Ou essayez de changer les ports en 81 et/ou 4001 s'il n'y a pas de netstat sur votre système.