【发布时间】:2018-12-19 11:21:39
【问题描述】:
我是 nginx 和 docker-compose 的新手。 我有一个 docker-compose,其中包含一个 nginx-reverse-proxy 和许多称为 webapi01、webapi02 的 Web API ...
在 nginx-reverse-proxy 中,我有
location /app1/{
proxy_pass http://webapi01:5000/;
}
location /app2/{
proxy_pass http://webapi02:5000/;
}
他们工作正常。
现在启动我的 docker-compose 后,我想通过修改指向我的 webApi01 的位置来调试我的 webapi01,并期望该请求将命中在 http://localhost:5000 列出的调试实例 webapi01
location /app1/{
#proxy_pass http://webapi01:5000/;
# what should be here so the request will be forward to the localhost(the machine, not the docker-compose ) so I can debug my webapi01
proxy_pass http://127.0.0.1:5000/;
}
但是,我无法让它工作。日志显示错误:connect() failed (111: Connection refused) while connection to upstream .......
那么问题是如何将请求从 nginx-reverse-proxy 重定向回主机(localhost)?
任何帮助或建议将不胜感激。
谢谢,
奥斯汀
【问题讨论】:
标签: docker-compose nginx-reverse-proxy