Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Access domains via IP
PostPosted: Sun Dec 20, 2009 1:42 pm 
Offline

Joined: Sun Dec 20, 2009 1:39 pm
Posts: 1
I'm building a new version of a site on my Linode Debian installation and would like to set it up so that I can access my domains via IP address before actually switching the DNS over as I've been able to do on other servers - in this case, not the main domain but one of the secondary domains I set up.

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" (http://library.linode.com/networking/co ... interfaces) and edited the /etc/network/interfaces file as well as the /etc/hosts but it did not seem to have any effect. Please note, I'm new to Linux so I might be misunderstanding a concept or two (ie, patience is appreciated), but I've hit a brick wall with the documentation.


Top
   
 Post subject:
PostPosted: Sun Dec 20, 2009 4:03 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Simplest way - add a line in format
Code:
#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!)


Top
   
 Post subject:
PostPosted: Sun Dec 20, 2009 5:38 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
Quote:
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 primary name-based virtual host).

The same is true for clients requesting a page using the IP address (e.g., http://12.34.56.78/) - Apache will serve pages from the first virtual host only. Don't know how nginx or lighttpd handle things.

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.


Top
   
 Post subject:
PostPosted: Sun Dec 20, 2009 7:29 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Vance wrote:
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group