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

前端 未结 4 892
我在风中等你
我在风中等你 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:45

    Well you could achieve that by editing your /etc/hosts file and add the proper entry for your web host

    1.1.1.1 web
    

    Obviouslly you'll have to replace 1.1.1.1 with the web server's real ip address (a private one I suppose). Save the file and try again. Another workaround would be to replace in the config:

    upstream docker-web {
        server web:8000;
    }
    

    with

    upstream docker-web {
        server web-ip-address:8000;
    }
    

    If you'll go for the 2nd, don't forget to restart/reload nginx!

提交回复
热议问题