nginx和web服务在同一个docker swarm的overlay网络中,因此它们可以跨主机访问。但是通过swarm部署web服务时,服务的ip只有启动容器时才分配,启动之前不知道这些web服务的IP。这就出现一个问题,nginx做反向代理时怎么配置web服务的地址呢?
If there is no exposed portuse service nameIf the port is exposedyou can use local IP + exposed port
Just write the service name directly
If there is no exposed port
use service name
If the port is exposed
you can use local IP + exposed port
Just write the service name directly