Does your /etc/hosts file look like this?
[code lang=”bash”]127.0.0.1 gladlycode.local gladlycast.local
127.0.0.1 babyessentials.local kw.sg.local
Every request I made to gladlyCode.local takes 5 seconds to resolve to my local Apache server. Something was wrong!
If it does and you’re on Mac OS X Lion, you should change your VirtualHost names to something else. It turns out that Mac OS X Lion no longer looks up /etc/hosts first when you try to lookup a .local domain since are technically reserved for Multicast DNS (MDNS), or Bonjour. Starting Lion, it will lookup through MDNS first, and after the 5 second timeout, it checks with /etc/hosts.
This is at a cost of developer productivity and I have to change all my .local domains to .internal.kw.sg which is a domain name I own. I figured that if it is a domain name I own, it will never clash unknowingly. I changed ‘gladlycode.local’ into ‘gladlycode.internal.kw.sg’ and point it to 127.0.0.1 now. Now testing gladlyCode no longer takes 5 seconds per request (ridiculous!).
Alternatively you can use another top level domain (TLD) instead of .local and the common ones such as .com.