【发布时间】:2015-12-31 00:28:07
【问题描述】:
在我的本地主机上,我有 Docker 和 2 个容器:Nginx 和 Golang。我想从本地机器发出请求并从 Go (localhost -> Nginx -> Go) 获得响应。
容器工作。我可以进入 Nginx 容器并运行
curl -v 'test:8080/path' -d "param1=value1&param2=value2" 我得到了正确的回应。
但是,如果我尝试从主机运行相同的请求,则会出现错误 - 502 Bad Gateway。如果我更改请求并运行curl -v -X POST 'test:8080/path'(没有数据的相同请求) - 没关系。
我的 Nginx 配置:
server {
listen 80;
server_name test;
client_max_body_size 20M;
charset utf8;
location / {
proxy_pass http://go:8000; // there go - docker compose link
}
}
我认为,Nginx 配置有问题。但我是 nginx 的新手。请帮帮我:)
【问题讨论】:
标签: nginx go docker docker-compose