關鍵詞:lighttpd 指定端口 代理
接到一個超級坑的需求,訪問lighttpd特定端口時轉換到其他服務器(uhttpd),lighttpd的80端口正常使用。
網上都是針對特定域名做跳轉,經過多次試驗,發現特定端口使用代理也很簡單。
啟用lighttpd的反向代理模塊:
編輯lighttpd/modules.conf文件,找到以下代碼:
## ## mod_proxy ## ##include "conf.d/proxy.conf"
去掉include "conf.d/proxy.conf"這一行的##
2編輯/etc/lighttpd/lighttpd.conf文件
添加以下代碼:
$SERVER["socket"] == "0.0.0.0:8776" { proxy.server = ( "" => ( ( "host" => "192.167.0.55", "port" => 80 ) ) ) }
這里8776是我指定的端口,訪問8776就會跳轉到192.167.0.55的80端口
重啟lighttpd
這時訪問lighttpd:8776 就會顯示192.167.0.55:80的內容了