如何在托管多个网站的服务器中通过 IP 地址访问网站? [英] How to access a website by IP address in a server that hosts many websites?

查看:76
本文介绍了如何在托管多个网站的服务器中通过 IP 地址访问网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在托管多个 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:

  1. http://mysubdomain1.domain.com
  2. http://mysubdomain2.domain.com
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆