質問

I would like to know how to access websites by IP address in a server that hosts more than one web application?

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?

Eg: I would like to access by IP address:

  1. http://mysubdomain1.domain.com
  2. http://mysubdomain2.domain.com
  3. http://mysubdomain3.domain.com

The server hosts many ruby on rails web apps via nginx and unicorn.

Thanks in advance.

役に立ちましたか?

解決

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

他のヒント

I don't think your question has enough information to be answered accurately not in depth.

Here are some thoughts.

There are different ways in which websites can be hosted. Via IP, aliases, named virtual hosts, etc.

There's a good chance that the server that's hosting those websites uses named based virtual hosts https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3

That is, one ip points to multiple servers. In that case, the only way you can get to it, is by knowing the domain name.

Here's more or less how it would work

  1. User requests http://mysubdomain1.domain.com
  2. Server with single ip has an entry for that subdomain1 and forwards requests to it.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top