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"