如何在托管多个网站的服务器中通过 IP 地址访问网站? [英] How to access a website by IP address in a server that hosts many websites?
问题描述
我想知道如何在托管多个 Web 应用程序的服务器中通过 IP 地址访问网站?
I would like to know how to access websites by IP address in a server that hosts more than one web application?
目前我可以获取服务器的IP地址,但默认指向一个站点.是否有前缀或后缀可以添加到 IP 地址以获取服务器中的特定网站?
Currently I can get the IP address of the server, but it points to one site by default. Is there a prefix or suffix that I can add to the IP address to get a particular website in the server?
例如:我想通过 IP 地址访问:
Eg: I would like to access by IP address:
http://mysubdomain1.domain.com
http://mysubdomain2.domain.com
http://mysubdomain3.domain.com
服务器通过 nginx 和 unicorn 托管了许多 ruby on rails 网络应用程序.
The server hosts many ruby on rails web apps via nginx and unicorn.
提前致谢.
推荐答案
假设服务器有一个公共 ip 地址,并且被设置为服务虚拟主机,你可以这样做:
Assuming that the server has one public ip address, and been set up to serve virtual hosts, you can do that like this:
curl -H "Host: subdomain.domain.com" IPADDRESS
curl -H "Host: subdomain.domain.com" IPADDRESS
这篇关于如何在托管多个网站的服务器中通过 IP 地址访问网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!