【发布时间】:2019-02-16 10:03:41
【问题描述】:
我在 docker 容器中设置了 NGINX,它可以正确地提供静态内容,所以那里没有问题。我将其配置为代理以指向我的 Mac 上的 Kestrel。 Kestrel 在端口 5000 上的响应很好(通过 Curl 检查),但由于某些奇怪的原因 NGINX 无法连接到它。
日志说:
15 connect() 在连接到时失败(111:连接被拒绝) 上游,客户端:172.17.0.1,服务器:[OMITTED],请求:“GET /api/values/5000 HTTP/1.1",上游: "http://127.0.0.1:5000/api/values/5000"
我的 NGINX 配置:
location / {
proxy_pass http://dotnet;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
upstream dotnet {
zone dotnet 64k;
server 127.0.0.1:5000;
}
【问题讨论】:
-
可能在serverfault.com上进行了更好的研究
标签: nginx asp.net-core kestrel-http-server kestrel