2
在landing.example.com:10000
有我可以正常工作的网络服务器,这是一个Docker容器,公开端口10000
。其IP是172.17.0.2
。如何调试当nginx给502坏的网关?
我想要的是在端口80
上有一个nginx反向代理,并根据访问的URL将访问者发送到不同的Docker容器。
server {
listen 80;
server_name landing.example.com;
location/{
proxy_pass http://172.17.0.2:10000/;
}
access_log /landing-access.log;
error_log /landing-error.log info;
}
当我这样做,我得到502 Bad Gateway
和日志说
2016/04/14 16:58:16 [error] 413#413: *84 connect()
failed (111: Connection refused) while connecting to upstream, client:
xxx.xxx.xxx.xxx, server: landing.example.com, request: "GET/HTTP/1.1",
upstream: "http://172.17.0.2:10000/", host: "landing.example.com"