运行环境:Ubuntu 23.03
1Panel版本:v1.10.13-lts
OpenResty版本:1.21.4.3-3-3-focal
以下出现的域名和IP均为示例文本,非真实域名和IP
如题所示,将AdGuard Home程序(可以视为一个自建DNS服务器,端口53)与1Panel一起部署于同一系统中,并在AdGuard Home中开启DNS重写(类似于在hosts自定义解析)。
AdGuard Home中将test.example指向192.168.1.10,同时将系统DNS(/etc/resolv.conf)改为localhost以使用自建的AdGuard Home作为DNS。此时,在Shell中ping test.example,成功解析到内网IP 192.168.1.10并ping通。但使用1Panel的OpenResty创建反向代理网站,在反代IP栏中填写test.example:9000,确认创建网站后会一直转圈,随后出现"请求超时"报错。在日志审计中查看错误信息如下:
信息
服务内部错误: stderr: 2024/08/12 14:06:41 [emerg] 93#93: host not found in upstream "test.example" in /www/sites/a.example.com/proxy/root.conf:2 nginx: [emerg] host not found in upstream "test.example" in /www/sites/a.example.com/proxy/root.conf:2 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
然而,在先前已创建的反向代理网站中,将反代地址由数字IP改为自建DNS服务器中重写的"test.example"后,即便重启OpenResty应用更改,网站也可以正常访问。
感到奇怪,因为在系统Shell中,可以成功解析我在自建DNS中重写的test.example并PING通,而在1Panel的OpenResty下创建网站,会提示host not found,请求帮助。