How do I access a server on localhost with nginx docker container?

后端 未结 5 1214
执念已碎
执念已碎 2020-12-13 03:05

I\'m trying to use a dockerized version of nginx as a proxy server for my node (ExpressJS) application. Without any configuration to nginx and publishing port 80 for the con

5条回答
  •  自闭症患者
    2020-12-13 03:39

    And finally, if you are using Nginx as a reverse proxy for multiple services, you can spin all of that with docker-compose. Make sure to expose ports “80:80” only on the Nginx service. Other services you can expose only the service port without mapping to the underlying network like so:

    web:
    .....
        expose:
           - 8080
    nginx:
    .....
        port:
            - “80:80”
    

    and then use Nginx configuration proxy_pass http://service-name:port You don’t need the upstream app part at all

提交回复
热议问题