Home  >  Q&A  >  body text

docker - 一台服务器,两个部署了nginx的容器,解析了两域名,想分别访问这两个容器不添加端口?

在一台vps上我跑了两个nginx的容器,同时指了两个域名到这个服务器,想这两个域名分别对应两个容器,怎样可以使这个两个域名不需要输入端口就可以直接访问

曾经蜡笔没有小新曾经蜡笔没有小新2707 days ago916

reply all(5)I'll reply

  • phpcn_u1582

    phpcn_u15822017-04-25 09:03:59

    You need to run a real nginx (not nginx container) on this server as a reverse proxy. Configure two servers in this real nginx setting, then declare your two domain names respectively, and make the request Forwarded to nginx of both containers.

    Please refer to this link for details

    reply
    0
  • 某草草

    某草草2017-04-25 09:03:59

    Search nginx configuration server_name

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-25 09:03:59

    I don’t know if this can help you
    /a/11...

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-04-25 09:03:59

    Search for nginx multi-domain name configuration. In fact, just write a few more server_name

    reply
    0
  • 黄舟

    黄舟2017-04-25 09:03:59

    One disadvantage of nginx without docker is that nginx cannot access static resources because the static resources are in docker.

    reply
    0
  • Cancelreply