如何在托管多个网站的服务器中通过 IP 地址访问网站?

编程入门 行业动态 更新时间:2024-10-27 14:30:06
本文介绍了如何在托管多个网站的服务器中通过 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:

  • mysubdomain1.domain
  • mysubdomain2.domain
  • mysubdomain3.domain
  • 服务器通过 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" IPADDRESS

    curl -H "Host: subdomain.domain" IPADDRESS

    更多推荐

    如何在托管多个网站的服务器中通过 IP 地址访问网站?

    本文发布于:2023-07-16 05:54:13,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1118565.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:多个   网站   器中   地址   如何在

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!