Access domains via IP
I figured the first step would be to get the IP to resolve to my main domain, but I can't even seem to get that to work. Currently when I access my main IP address it delivers the default "It Works"HTML file in the /var/www folder, rather than the folder for the domain itself.
I followed the instructions on "Adding IP Addresses" (
3 Replies
#Your Linode's IP Desired DNS name
111.222.333.444 www.example.tld
111.222.333.444 sub1.example.tld
111.222.333.444 other.example.tld
to the hosts file on your workstation - it will make this specific computer look for that domain at the new address, while all the stuff around the world will receive the "old" address from DNS.
It's /etc/hosts on Unixen, and %WINDIR%\system32\drivers\etc\hosts on Windows.
(Yes, witout an extension; if you edit it with Notepad or Wordpad it might add a .txt at end, which you'll have to remove afterwards!)
> As mentioned earlier, there are some clients who do not send the required data for the name-based virtual hosts to work properly.
These clients will always be sent the pages from the first virtual host listed for that IP address
The same is true for clients requesting a page using the IP address (e.g.,
Editing your hosts files as rsk suggests is probably the easiest way to test (don't forget to change it back afterward!).
Note that if you're using IP-based virtual hosts rather than name-based, you should see this instead
@Vance:
Don't know how nginx or lighttpd handle things.
With Lighty one can set default settings (and therefore default docroot) and override those settings for individual domains using regex based matching against Host (or url, or a few other hooks). For most advanced purposes similar to Apache virtual hosts, this is the only way.