lighttpd指定端口做代理服务器 启用lighttpd的反向代理模块: 2编辑/etc/lighttpd/lighttpd.conf文件 重启lighttpd

  关键词:lighttpd 指定端口 代理

接到一个超级坑的需求,访问lighttpd特定端口时转换到其他服务器(uhttpd),lighttpd的80端口正常使用。

网上都是针对特定域名做跳转,经过多次试验,发现特定端口使用代理也很简单。

编辑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的内容了