Rack, FastCGI, Lighttpd configuration
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 ap开发者_StackOverflow中文版p, :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?
You have some process already running on port 80 or 4000, check with netstat -anp
command.
Or try to change ports to 81 and/or 4001 if there's no netstat on your system.
精彩评论