我在树莓派3B +上运行Homebridge和Pi-Hole。现在我想要的是这两个服务都可以通过dns名称而不是url中的ip和port进行访问。
homebridge:192.168.0.88:8581 ==> homebridge.merckarion.home
pihole:192.168.0.88 ==> pihole.merckarion.home
我如何做到这一点?
答案 0 :(得分:0)
我能够相对轻松地实现这一目标。首先,configure pi-hole's local DNS to point the domain names you want to the pi's IP。然后,编辑 /etc/lighttpd/external.conf
以将 Homebridge 域反向代理到正确的端口:
server.modules += ( "mod_proxy" )
$HTTP["host"] == "home.bridge" {
proxy.server = ( "/" => ( (
"host" => "127.0.0.1",
"port" => 8581
) ) )
}
最后用sudo systemctl restart lighttpd
重启lighttpd服务。显然,您需要将 home.bridge
替换为您想要的域名。
我正在使用 pi-hole 管理员的默认域名之一。如果您想使用非默认名称,则需要将以下内容添加到 external.conf
中,否则 lighttpd 将不知道如何处理您的请求:
$HTTP["host"] == "mycoolpiholedomain.biz" {
server.document-root = "/var/www/html/admin/"
}