3

I've installed Mac OS X Server 10.6.3 on my laptop to use as my normal OS. I do a lot of web development and thought it would be handy to run OS X Server so I could more easily manage my local development environment (Apache Virtual Hosts, Hostnames for each local site, etc).

I'm really enjoying the new setup except for one problem. DNS. My ideal situation would be to add a site (some-site.local) in the Web Service and then go to the DNS Service and add a primary record for the new site.

I actually got this working at one point but after a reboot it stopped working! The records look the same as they did before the reboot but the site doesn't come up in Safari.

Here is a list of my needs:

  • Need to be able to add new domains at a whim
  • Domains always map to a site on the same box's Web Service
  • Local & External IPs often change
  • It would nice if it worked on any network (i.e. WiFi at the airport or coffee shop)
  • Sites only need to be accessible locally
  • Configuration should stay put even after rebooting

I've done some googling and used this as a bit of guide.

In the past I've used MAMP and then just a local Apache/PHP/MySQL install with a manually managed hosts file. I'd rather not go back.

3 Answers 3

3

There is absolutely no need to run OS X Server just to get a web development environment. In fact there are a few good reasons not to!

Just run normal OS X and add the sites to your Hosts file and add the virtual hosts to your Apache conf. If you use Xampp or MAMP (as the built in OS X Apache is a bit rubbish) it's very easy to set up.

  • Domains always map to a site on the same box's Web Service - Check
  • Local & External IPs often change - Check
  • It would nice if it worked on any network - Check
  • Sites only need to be accessible locally - Check (Just turn on the firewall or set Apache to only serve pages on localhost)
  • Configuration should stay put even after rebooting - Check

  • Need to be able to add new domains at a whim - Admittedly not as friendly as the OS X server interface, but still not very hard to use.

You just do not need OS X server for a personal web development, as you have found out changing IP address will screw up DNS resolution. Also OS X server is optimised for background (service) applications, far from ideal when developing.

Also since you get OS X with your Mac and OS X server costs $500+ it's not really worth it...


To actually answer your question!

Don't use the DNS server use the host file - this ensures that you will get to your virtual hosts regardless of your IP address with the minimum of fuss.

Although... if you had to use OS X Server's DNS server you could create a virtual Ethernet interface assign that a static IP address and use that IP address for your DNS A records. I haven't tested this though.

3
  • I run normal OS X and use the hosts files right now, was looking for something a little more powerful. Thanks for the help though.
    – joshwbrick
    Apr 5, 2010 at 13:56
  • @macinjosh - if you had to use OS X Server's DNS server you could create a virtual Ethernet interface assign that a static IP address and use that IP address for your DNS A records. I haven't tested this though. Apr 5, 2010 at 23:33
  • Or just use 127.0.0.1 for the A record address.
    – MDMarra
    Sep 1, 2010 at 3:34
1

Is your network config set to use 127.0.0.1 as the DNS server? If you are using an external DNS for name resolution you won't use the DNS records on your local box, even if it is running DNS.

1
  • Yes I have 127.0.0.1 as DNS server in my network preferences, followed by Google's open DNS server IPs (8.8.8.8, 8.8.4.4)
    – joshwbrick
    Apr 5, 2010 at 1:51
1

Lots of reasons to use Mac Server as a dev environment rather than regular Mac OS. Apple does not permit virtualization of the regular OS, only the Server. There are tons of advantages to doing development in a VM. You can snapshot it. You back it up regularly and when your laptop gets stolen or dies you don't need a week to get your environment back to where you had it. Fellow developer changes jobs? Just take his VM and set it up on your box and go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .