19

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の下にあり、静的な「Helloworld!」です。ページ。問題は、DeviceAを介してこれらのファイルにアクセスできないことですが、DeviceC(ポート12345でリッスン)でも実行されているテストサービスを呼び出すと、すべて正常に機能します。

リクエストがポート80で着信した場合、DeviceB、DeviceCのWebサーバーはindex.htmlで応答する必要があると言っているのは間違っていますか?

lighttpd.conf DeviceA @ 192.168.1.10 server.modules =( "mod_proxy")

proxy.server = ( 
"/DeviceB" => ( "" => ( "host" => "192.168.1.20", "port" => 80 )),
"/DeviceC" => ( "" => ( "host" => "192.168.1.30", "port" => 80 )),  
"/TestService" => ( "" => ( "host" => "192.168.1.30", "port" => 12345 ))
)

lighttpd.conf DeviceB @ 192.168.1.20

server.document-root = "/var/www"
server.port = 80
index-file.names = ( "index.html" )

lighttpd.conf DeviceC @ 192.168.1.30

server.document-root = "/var/www"
server.port = 80
index-file.names = ( "index.html" )

アップデート

URLを書き換え/リダイレクトするためにproxy.server()の周りに$ HTTP ["host"] == ...が必要ですか?または、何をプロキシするかを定義する方法

4

2 に答える 2

6

必要なパッケージ

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 の完全なドキュメントについては、http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModProxyを参照してください。

于 2012-07-27T10:42:25.537 に答える