Configuration Lighttpd负载平衡配置

Configuration Lighttpd负载平衡配置,configuration,localhost,port,load-balancing,lighttpd,Configuration,Localhost,Port,Load Balancing,Lighttpd,我正在使用Lighttpd1.4.30配置Play框架中的负载平衡器 我在lighttpd-inc.conf中给出了如下条目 $HTTP["host"] =~ "http://10.74.9.109:9020" { proxy.balance = "round-robin" proxy.server = ( "/" => ( ( "host" => "10.74.9.109", "port" => 9020 ) ) ) } $HTTP["host"] =~ "http://1

我正在使用Lighttpd1.4.30配置Play框架中的负载平衡器

我在lighttpd-inc.conf中给出了如下条目

$HTTP["host"] =~ "http://10.74.9.109:9020" {
proxy.balance = "round-robin" proxy.server = ( "/" =>
( ( "host" => "10.74.9.109", "port" => 9020 ) ) )
}

$HTTP["host"] =~ "http://10.74.9.109:80" {
    proxy.balance = "round-robin" proxy.server = ( "/" => ( 
          ( "host" => "10.74.9.109", "port" => 9020 ), 
          ( "host" => "10.74.9.109", "port" => 9030 ) ) 
    )
}
我的play应用程序在端口9020、9030上运行良好


但是当我尝试
http://localhost:80
my load balancer应将请求传输到这些未发生的端口中的任何一个。我只得到Lighttpd测试页面。

首先确保您的
服务器.modules
阵列中有mod_代理

我认为使用
$HTTP[“主机”]
是这里的问题。您应该像这样使用
$SERVER[“socket”]

$SERVER["socket"] == ":9020" {
    proxy.server = (
        "/" => (
            (
                "host" => "10.74.9.109",
                "port" => 9020
            )
        )
    )
}

$SERVER["socket"] == ":80" {
    proxy.server = (
        "/" => ( 
              ( "host" => "10.74.9.109", "port" => 9020 ), 
              ( "host" => "10.74.9.109", "port" => 9030 )
        ) 
    )
}

可能重复的您找到解决方案了吗?