Web-server – Use Mac OS X Server As Development Environment

binddomain-name-systemlocalmac-osx-serverweb-server

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.

Best Answer

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.

Related Topic