简体   繁体   English

docker nginx-proxy“坏网关”

[英]docker nginx-proxy "Bad Gateway"

I have what I think is exactly the setup prescribed in the documentation.我认为正是文档中规定的设置。 Easy peasy, development-only, no SSL ... But I'm getting "Bad Gateway." Easy peasy,仅限开发,没有 SSL ......但我得到了“坏网关”。

docker exec ... cat /etc/nginx/conf.d/default.conf

... seems to correctly identify the internal IP-address of the other-container of interest ... which means that scanning for ENV VIRTUAL_HOST obviously worked: ...似乎正确识别了其他感兴趣的容器的内部 IP 地址 ...这意味着扫描ENV VIRTUAL_HOST显然有效:

upstream my_site.local {
   [...]
   server 172.16.238.5:80    # CORRECT!
}

When I do docker logs app_server I see ... silence.当我做docker logs app_server我看到......沉默。 The server isn't being contacted.未联系服务器。

When I do docker logs nginx_proxy I see this:当我做docker logs nginx_proxy我看到这个:

failed (111: connection refused) while connecting to upstream, client 172.16.238.1 [...] upstream: "172.16.238.5:80/"

The other container specifies EXPOSE 80 ... so, why is the connection being refused and who is refusing it?另一个容器指定EXPOSE 80 ... 那么,为什么连接被拒绝,谁在拒绝它?

Well, as I said above, I realized the error of my ways and did this:好吧,正如我上面所说,我意识到我的方式错误并这样做了:

  • VIRTUAL_PROTO=fastcgi
  • VIRTUAL_ROOT=/var/www

... and within the Dockerfile of the app container I apparently did need to EXPOSE 9000 . ...在应用程序容器的Dockerfile中,我显然确实需要EXPOSE 9000 (This being the default port used by php-fpm for FastCGI purposes.) (这是php-fpm用于 FastCGI 目的的默认端口。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM