Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I try to run a rails app on lighttpd, but the server does not start because the fastcgi-backend fails to start. This is the error log of lighttpd:

2011-08-02 20:43:15: (log.c.166) server started 
2011-08-02 20:43:15: (mod_fastcgi.c.1104) the fastcgi-backend /opt/gemeinschaft/public/dispatch.fcgi failed to start: 
2011-08-02 20:43:15: (mod_fastcgi.c.1108) child exited with status 13 /opt/gemeinschaft/public/dispatch.fcgi 
2011-08-02 20:43:15: (mod_fastcgi.c.1111) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags. 
2011-08-02 20:43:15: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed. 
2011-08-02 20:43:15: (server.c.938) Configuration of plugins failed. Going down.

My lighttpd.conf looks like this:

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
    "mod_rewrite",
    "mod_fastcgi",
    "mod_accesslog",
)
server.errorlog            = "/var/log/lighttpd/error.log"
accesslog.filename         = "/var/log/lighttpd/access.log"
server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"

index-file.names            = (
                                "index.html",
                                "index.htm",
                              )

url.access-deny             = ( "~", ".inc", ".htaccess", ".htpasswd" )

static-file.exclude-extensions = ( ".fcgi" )

server.port = 80
include_shell "/usr/share/lighttpd/use-ipv6.pl"

dir-listing.encoding        = "utf-8"
server.dir-listing          = "disable"

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = (
                                "application/x-javascript",
                                "text/css",
                                "text/html",
                                "text/plain",
                              )

server.reject-expect-100-with-417 = "disable"
# Available since 1.4.21.
# http://redmine.lighttpd.net/wiki/lighttpd/Release-1.4.21
# http://redmine.lighttpd.net/issues/1017

include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"


$SERVER["socket"] == ":80" {
            #   "^/((?!(setting|freeswitch)).*)" => "https://%1/$1" 
    url.rewrite-once = ("^/(setting|freeswitch|manufacturer_snom).*" => "$0",
            "^/(.*)" => "/secure/$1")

    $HTTP["host"] =~ "(.*)" {
        url.redirect = ("^/secure/(.*)" => "https://%1/$1")
    }
    server.document-root     = "/opt/gemeinschaft/public/"
    server.error-handler-404 = "/dispatch.fcgi"
    fastcgi.server = (
        ".fcgi" => (
            "Gemeinschaft" => (
                "socket" => "/tmp/gemeinschaft-fcgi.socket",
                "bin-path" => "/opt/gemeinschaft/public/dispatch.fcgi",
                "min-procs" => 1,
                "max-procs" => 2,
            )
        )
    )


}

$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
       ssl.pemfile = "/etc/ssl/amooma/server.pem" 

    server.document-root     = "/opt/gemeinschaft/public/"
    server.error-handler-404 = "/dispatch.fcgi"
    fastcgi.server = (
        ".fcgi" => (
            "Gemeinschaft" => (
                "socket" => "/tmp/gemeinschaft-fcgi.socket",
                "bin-path" => "/opt/gemeinschaft/public/dispatch.fcgi",
                "min-procs" => 1,
                "max-procs" => 2
            )
        )
    )
    #fastcgi.debug = 1
}

And here is the dispatch.fcgi:

#!/usr/bin/ruby1.9.1

require 'rubygems'
require 'fcgi'

ENV['RAILS_ENV'] ||= 'development'

# Set GEM_PATH and GEM_HOME
#ENV['GEM_PATH'] ||= '/usr/local/rvm/gems/ruby-1.9.2-p290/gems' #'/usr/local/lib/ruby/gems/1.9.1/gems/'
#ENV['GEM_HOME'] ||= '/usr/local/rvm/gems/ruby-1.9.2-p290/gems' #'/usr/local/lib/ruby/gems/1.9.1/gems/'
# Must not be used, otherwise we get a strange error:
# "Could not find rake-0.8.7 in any of the sources".

#require File.join(File.dirname(__FILE__), '../config/environment')
require File.join('/home/ft/programming/Gemeinschaft4/config/environment')

class Rack::PathInfoRewriter
  def initialize(app)
    @app = app
  end

  def call(env)
    env.delete('SCRIPT_NAME')
    parts = env['REQUEST_URI'].split('?')
    env['PATH_INFO'    ] = parts[0]
    env['QUERY_STRING' ] = parts[1].to_s
    @app.call(env)
  end
end

Rack::Handler::FastCGI.run(
  Rack::PathInfoRewriter.new(
    Gemeinschaft4::Application
  )
)

running the dispatch.fcgi as ruby script like this: ruby1.9.1 /path/to/dispatch.fcgi produces no error.
when there is no bin-path entry in lighttpd.conf the server starts. But whenever i add

"bin-path" => /some/path/dispatch.fcgi

this error occurs again.
Any hint would be appreciated.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.