代码之家  ›  专栏  ›  技术社区  ›  EramSa

为什么nginx虚拟主机不能在互联网上使用?

  •  -1
  • EramSa  · 技术社区  · 7 年前

    我做了一个 virtual host 使用nginx,我已经添加到 host

    127.0.0.1        testapp
    

    虚拟主机 http://testapp 在我的 VPS

    server {
            listen       80;
            server_name  testapp testapp.51.x.x.172;
            ##root   html;
            root c:/apps/web;
            index  index.html index.htm;
            }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Parsaria    7 年前

    你有 DNS 问题 CNAME record 在你的主机上 testapp FQDN将为 testapp.yourdomain.com 目标主机应该是您的 yourdomain.com 已经注册的 A record .

    在主机中,您应该添加此行。

    127.0.0.1    testapp.yourdomain.com
    

    你的问题解决了 proxy revers 在web服务器上。