解析时Nginx连接被拒绝



我有一个简单的应用程序,有公共地址,让我们说http://example.com我需要设置反向代理,它将转发请求到此服务,因此我将nginx作为docker映像运行,并使用以下配置。

http {
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
proxy_http_version 1.1;
proxy_set_header "Connection" "";
resolver 127.0.0.11;
proxy_pass http://example.com;
}
}
}

但是它不工作,我收到一堆

send() failed (111: Connection refused)127.0.0.11:53

最后,

example.com无法解析(110:Operation timed out),

解决方案是使用Google Public DNS。最重要的是,我不得不转向ipv6,因为它引起了其他问题。

resolver 8.8.8.8 ipv6=off;

最新更新