Docker: proxy_pass to another container - nginx: host not found in upstream

前端 未结 4 874
我在风中等你
我在风中等你 2021-01-12 04:18

(I know others have asked this question before, but I\'m not able to solve the problem using the solutions proposed in other posts, so i figured i would try to post my c

4条回答
  •  无人共我
    2021-01-12 04:35

    It's simple. Just change the old configuration:

    upstream docker-web {
        server web:8000;
    }
    

    To this new one:

    upstream docker-web {
        server web:80;
    }
    

    The reason is, between containers can't communicate with published port. It just can communicate with the target port. 8000:80 (8000 is published port and 80 is target port).

    Let say you have 8000:443, you must create the configuration with "server web:443" inside Nginx listen to 443 port number. May this help.

提交回复
热议问题