为什么 nginx 虚拟主机在互联网上不可用?
Why nginx virtual host is not available from internet?
我用 nginx 做了一个 virtual host
我已经添加到 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;
}
您有 DNS
个问题。
您必须在您的主机上定义一个 CNAME record
,例如 testapp
FQDN 将是 testapp.yourdomain.com
,目标主机应该是您的 yourdomain.com
,它已经注册 A record
。
在您的主机中,您应该添加这一行。
127.0.0.1 testapp.yourdomain.com
你的问题已经解决了
但是您可能需要在您的网络服务器上完成 proxy revers
。
我用 nginx 做了一个 virtual host
我已经添加到 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;
}
您有 DNS
个问题。
您必须在您的主机上定义一个 CNAME record
,例如 testapp
FQDN 将是 testapp.yourdomain.com
,目标主机应该是您的 yourdomain.com
,它已经注册 A record
。
在您的主机中,您应该添加这一行。
127.0.0.1 testapp.yourdomain.com
你的问题已经解决了
但是您可能需要在您的网络服务器上完成 proxy revers
。