DNS issue

Discussion in 'macOS' started by johnkolen, Mar 22, 2010.

  1. johnkolen macrumors newbie

    Joined:
    Mar 22, 2010
    #1
    Hi there,

    thnx for reading my very first post :)

    I got a question about a DNS setting. We are developing a website
    thats has no url yet (it in use and will be moved after the developing is
    finished). Until then we want to call it by it's ip adres.
    for example the ip is 123.45.678.901

    How can I set in my mac os x that when I enter the url it links
    to the ip adress? For the main site entering the ip adress is no problem,
    this will link good. http://123.45.678.901 shows the right content.
    But http://shop.123.45.678.901 is not working. We need to work on
    the subdomain as well. That's why we want to set dns for this.

    Hope my question is clear, and someone can help me out here.

    Best regards,

    John
     
  2. yotd macrumors member

    Joined:
    Feb 21, 2010
    #2
    You want the hosts file. This is a local DNS lookup which you can use for this kind of thing. Take a look in
    Code:
    /etc/hosts
    The format is very easy to understand. Just add the relevant entry on the machine you're browsing from.

    You'll need elevated permissions, so you'll need to sudo and edit it in your favourite text editor (e.g.
    Code:
    sudo vi /etc/hosts
    or
    Code:
    sudo nano /etc/hosts
    )

    EDIT: Obviously you'll need to set the virtual hosting settings on your webserver to respond to whatever hostname you use. I tend to use something www.mywebsite.com.demo . Then it's just a little tweak in the sever's config file for deployment.
     
  3. johnkolen thread starter macrumors newbie

    Joined:
    Mar 22, 2010
    #3
    is it local? the site I want to go to is also online.

    Sorry if this is a stupid question, but I was told it should be
    done "the dns" way but no clue how..
     
  4. yotd macrumors member

    Joined:
    Feb 21, 2010
    #4
    One way to do things (the way I do it) is to set up my development web server as a virtual or real machine on the local network, with a static IP address. I then add a mapping like this on the machine I'm browsing (etc) from:

    Code:
    109.74.206.174  www.mysite.com.local
    
    This means that whenever my browsing machine tries to resolve www.mysite.com.local it will get that IP address. What it's doing is short-circuiting the DNS look up. So yes, you could call it "the DNS way".

    The other half is configuring the www server, I assume you know how to do this.
     
  5. johnkolen thread starter macrumors newbie

    Joined:
    Mar 22, 2010
    #5
    the site is allready hosted with my provider they gave me the ip adress where the regular site can be found. So i think the configuration of the server is not necessary, just how to acces the subdomain in the browser.
     

Share This Page