Project

General

Profile

Bug #468

Only one rails app works under lighttpd using named virtual hosts

Added by Anonymous over 11 years ago. Updated 7 months ago.

Status:
Fixed
Priority:
High
Assignee:
-
Category:
mod_fastcgi
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:

Description

I am trying to run several rails applications under the same lighttpd process using named virtual hosts. One of them works and the other does not. The other always gives me a "400 - Bad Request" message. It doesn't matter which order they are defined in in the config file. To make sure it wasn't the application i copied the good app and used it twice as follows: "cp -rp Sites/foo Sites/bar". This had no effect. Still "bar" returned "400 - Bad Request". Running lighttpd separately for "bar" using the rails "./script/server" script works perfectly.

I am running Mac OS X 10.4.4, lighttpd 1.4.8 (installed using DarwinPorts), and the latest Rails (installed via rubygems).

Here are the relevant config files:

lighttpd.conf:


server.pid-file             = "/opt/local/var/run/lighttpd.pid" 
server.bind                 = "127.0.0.1" 
server.port                 = 80
server.event-handler        = "freebsd-kqueue" # *important osx/freebsd only option *
server.username             = "www" 
server.groupname            = "www" 
server.modules              = ( "mod_rewrite", "mod_fastcgi", "mod_accesslog" )
server.indexfiles           = ( "dispatch.fcgi", "index.html" )

server.document-root        = "/Library/WebServer/Documents/" 
server.errorlog             = "/opt/local/var/log/lighttpd/server.log" 
accesslog.filename          = "/opt/local/var/log/lighttpd/access.log" 

debug.log-file-not-found    = "enable" 
debug.log-request-handling  = "enable" 
debug.log-request-header    = "enable" 
debug.log-response-header   = "enable" 

include "mime.types.conf" 

var.basedir                 = "/Sites/" 

$HTTP["host"] == "foo" {
    var.servername          = "foo" 
    include "rails-vhost.conf" 
}

$HTTP["host"] == "bar" {
    var.servername          = "bar" 
    include "rails-vhost.conf" 
}

$HTTP["host"] == "rails-api" {
    var.servername          = "rails-api" 
    include "vhost.conf" 
}

$HTTP["host"] == "ruby-api" {
    var.servername          = "ruby-api" 
    include "vhost.conf" 
}

rails-vhost.conf:


server.document-root        = basedir + servername + "/public/" 
server.error-handler-404    = "/dispatch.fcgi" 
server.errorlog             = basedir + servername + "/log/server.log" 
accesslog.filename          = basedir + servername + "/log/access.log" 
fastcgi.server              = ( ".fcgi" =>
    ( servername =>
        (
            "socket" => "/tmp/" + servername + ".socket",
            "bin-path" => basedir + servername + "/public/dispatch.fcgi",
            "bin-environment" => ( "RAILS_ENV" => "development" ),
            "min-procs" => 1,
            "max-procs" => 2,
        )
    )
)

-- yon-lighttpd

History

#1 Updated by conny over 11 years ago

I assume it's not because of the multiple fastcgi.server's that go into the parsed config?

- Did you ever get it to work later on?

#2 Updated by stbuehler over 9 years ago

  • Status changed from New to Fixed
  • Resolution set to worksforme

server.errorlog does not work in conditionals, but i don't think that was the problem.

Missing user feedback.

#3 Updated by stbuehler almost 9 years ago

  • Status changed from Fixed to Missing Feedback

#4 Updated by gstrauss 7 months ago

  • Description updated (diff)
  • Category changed from core to mod_fastcgi
  • Status changed from Missing Feedback to Fixed
  • Target version set to 1.4.x

fixed in lighttpd 1.4.40 where lighttpd checks for duplicated socket paths and treats matches as the same backend, rather than trying to start them up independently (which will fail on the same socket path)

Also available in: Atom