michael_kent123 Posted February 22, 2015 Share Posted February 22, 2015 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. Quote Link to comment Share on other sites More sharing options...
digip Posted February 23, 2015 Share Posted February 23, 2015 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. Quote Link to comment Share on other sites More sharing options...
michael_kent123 Posted February 23, 2015 Author Share Posted February 23, 2015 I take your point. I was so used to having shared IPs that I forgot that the VPS means that only I use a specific IP! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.