Jump to content

How does this hosting situation actually work? I am perplexed!


michael_kent123

Recommended Posts

Here is something I do not understand even though I'm sure there is a simple answer.

I SSH to my VPS. This VPS has not had DNS propagation started. I can only access it via an IP address. I upload some files to /var/www/

I then go in the web browser to the VPS IP. I can see the files e.g. index.html.

Here is what I do not understand.

How does the web browser know the correct content to serve me? Presumably, I am not the only person using that IP address.

If I were to have linked the domain name to the IP via DNS propagation, then my domain panel would point to the nameservers of the VPS and I would have entered my domain name in the VPS control panel. Hence, when I request www.domain.com, I am given the correct files as the domain name and IP are linked.

But in this case, I just type http://50.50.50.50/index.html. How does the VPS know what to give me? The files are stored on their servers. I do not host anything in my /var/www/ directory.

Link to comment
Share on other sites

You answered your own question.

"How does the web browser know the correct content to serve me? Presumably, I am not the only person using that IP address."

VPS - Virtual, Private Server, ie: Your assigned IP for your domain, even if the domain name has not propagated or have the A record to match the name, the IP is still yours since you own it. You can get files off a server by IP alone if the web server is up and running. This works because it's not a shared host, where the hosting company redirects via DNS, your request for the domain name, to the internal IP, while it's external is shared by many, as where with the VPS, your IP will be the same as the domain name in the browser, and is why it works both ways. It's A record may not be associated with the domain name yet, but the IP is already assigned and accessible, live on the internet, so if files are there, they can be accessed. The browser knows nothing other than to do a GET request for the IP the same as it would the domain name and the server sends back what it asks for, same as it would if you typed in the domain name itself. DNS handles all of this for you in either case and the route to the IP is known to other servers via DNS.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...