DNS issue

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

  1. johnkolen macrumors newbie

    Mar 22, 2010
    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,

  2. yotd macrumors member

    Feb 21, 2010
    You want the hosts file. This is a local DNS lookup which you can use for this kind of thing. Take a look in
    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.
    sudo vi /etc/hosts
    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

    Mar 22, 2010
    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

    Feb 21, 2010
    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:  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

    Mar 22, 2010
    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