lighttpd作为反向代理
DeviceA充当反向代理,并按如下方式转发请求: 192.168.1.10/DeviceB==>192.168.1.20/index.html 192.168.1.10/DeviceC==>192.168.1.30/index.html 这两个索引文件都位于/var/www下,是静态的“Hello world!”页面。问题是我无法通过DeviceA访问这些文件,但是如果我调用同样在DeviceC上运行的测试服务(在端口12345上侦听),一切都正常 如果请求从端口80传入,DeviceB、DeviceC上的web服务器应该用index.html响应,这是不是说错了 lighttpd.conf DeviceA@192.168.1.10 server.modules=(“mod_代理”) lighttpd.conf DeviceB@192.168.1.20 lighttpd.conf DeviceC@192.168.1.30lighttpd作为反向代理,lighttpd,reverse-proxy,mod-proxy,Lighttpd,Reverse Proxy,Mod Proxy,DeviceA充当反向代理,并按如下方式转发请求: 192.168.1.10/DeviceB==>192.168.1.20/index.html 192.168.1.10/DeviceC==>192.168.1.30/index.html 这两个索引文件都位于/var/www下,是静态的“Hello world!”页面。问题是我无法通过DeviceA访问这些文件,但是如果我调用同样在DeviceC上运行的测试服务(在端口12345上侦听),一切都正常 如果请求从端口80传入,DeviceB、De
更新
server.modules = (
...
"mod_proxy",
...
)
我是否需要$HTTP[“主机”]==。。。围绕proxy.server()重写/重定向URL?或者,如何定义什么是代理(ed)所需的软件包
server.modules = (
...
"mod_proxy",
...
)
您的前端代理设置:适用于lighttpd.conf@192.168.1.10
$HTTP["url"] =~ "^.*DeviceB" {
proxy.server = ( "" =>
(( "host" => "192.168.1.20", "port" => 80 ))
)
}
$HTTP["url"] =~ "^.*DeviceC" {
proxy.server = ( "" =>
(( "host" => "192.168.1.30", "port" => 80 ))
)
}
有关lighttpd mod_proxy的完整文档,您可以参考lighttpd开发人员从几年前就知道您的需要 根据版本的不同,解决方案或新功能可以解决此问题 Lighttpd 1.4 bugtracker中介绍了一种解决方法: Lighttpd 1.5 他们使用此命令()添加了此功能: 代理核心。重写请求:重写请求头或请求uri
$HTTP["url"] =~ "^/DeviceB" {
proxy-co...
proxy-core.rewrite-request = (
"_uri" => ( "^/DeviceB/?(.*)" => "/$1" ),
"Host" => ( ".*" => "192.168.1.20" ),
)
}
应该是服务器故障,不是SOW这里的问题是什么?我在帮助Lighttpd方面没有问题,但我看到了很多设置,没有真正的问题(至少在设置过程中是有意义的)…问题是如何设置proxy.server(),以便将192.168.1.10/DeviceB请求转发到192.168.1.20/index.html
$HTTP["url"] =~ "^.*DeviceB" {
proxy.server = ( "" =>
(( "host" => "192.168.1.20", "port" => 80 ))
)
}
$HTTP["url"] =~ "^.*DeviceC" {
proxy.server = ( "" =>
(( "host" => "192.168.1.30", "port" => 80 ))
)
}
$HTTP["url"] =~ "(^/DeviceB/)" {
proxy.server = ( "" => ("" => ( "host" => "127.0.0.1", "port" => 81 )))
}
$SERVER["socket"] == ":81" {
url.rewrite-once = ( "^/DeviceB/(.*)$" => "/$1" )
proxy.server = ( "" => ( "" => ( "host" => "192.168.1.20", "port" => 80 )))
}
$HTTP["url"] =~ "^/DeviceB" {
proxy-co...
proxy-core.rewrite-request = (
"_uri" => ( "^/DeviceB/?(.*)" => "/$1" ),
"Host" => ( ".*" => "192.168.1.20" ),
)
}