Portal Home > Knowledgebase > Articles Database > DNS and shared servers question


DNS and shared servers question




Posted by mounty, 03-18-2008, 03:53 PM
If I have 'mydomain.url' registered with company A, and that points to a shared web server with company B, how does the web server know which of the pages it hosts to serve to the visitors, since they are all on the same IP?

Posted by JulesR, 03-18-2008, 04:12 PM
It's called Virtual Hosting. Simply put, the server listens for requests on port 80 (web) for your domain name and then pulls content from your certain directory. That way hundreds/thousands of domains can share a single IP address. It's all in the name

Posted by mounty, 03-18-2008, 05:55 PM
So if my web root was in: 'myaccount/domain.url', what would happen if someone else used the same domain name in their web root?

Posted by JulesR, 03-18-2008, 06:02 PM
It doesn't work the way you seem to be expecting it. Take the following situation (note, this is incredibly simplified) YourDomain.tld points to 123.123.123.123 (for example). YourFriendsDomain.tld points to 123.123.123.123 (for example). MyDomain.tld points to 123.123.123.123 (for example). If you were to browse to http://123.123.123.123 in your browser, you would in all likeliness receive an error, or a blank page. Generally shared IP's (like in this instance) are not used to host any content. What in fact happens is, the web service at 123.123.123.123 is configured using Virtual Hosts. That is, it listens on this IP address for hostname requests, like yourdomain.tld, mydomain.tld, and so on. When you punch in http://www.yourdomain.tld in the browser, it hits the server on 123.123.123.123 who sees that you are requesting site information for "Yourdomain.tld". It will then search its configuration files for where to load the content from (usually /home/username/public_html/ on WHM for example) and load the appropriate website. The configuration of Virtual Hosts are not controlled by the users, and is entirely a service side function.

Posted by mounty, 03-18-2008, 06:25 PM
Makes sense, but then if you don't have access to the web server options, the server admins would have to point the certain domain to your directory in their config to give you control of the site, I think?

Posted by JulesR, 03-18-2008, 06:28 PM
Yes, that's right. They'd do this when you purchased or otherwise obtained hosting with them. The don't really have to "point" anthing, just set up the virtual host entries for your domain. You would then update your DNS to point to the shared IP address they provide you, and everything falls into place

Posted by mounty, 03-18-2008, 06:41 PM
Ah it all makes sense! Now to test the theory.. Much obliged



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read