Apache slow to find localhost -- how can I fix? I'm running XAMPP on my Mac, which is just an Apache and MySQL server running as my local host. When I set it up, I found port 8000 (the default) was already taken (maybe by the Apache that ships inside OS X?) so I just reconfigured the httpd.conf file to tell it to listen on port 8080.

Anyhow, it all works, and I even have put in some settings in /etc/hosts so I can just type "mysite.local:8080" into my browser.

Here's the ONLY problem: often when going to fetch a page from the local host, my Mac takes a while (1-10 seconds) on the "sending request" or "looking up" step of retrieving the page, and then finally the page loads and renders. It's actually faster for me to access my production server (that is several states away!)... obviously that's absurd and my local server, all right here on the same machine, should be lightning fast. Any ideas why it's so slow, and how I can fix it?
A few things:


Apache built into OS X runs on port 80. If XAMPP couldn't start the web server erroring because port 8000 is in use, something is listening on that port already. You did one of the right things in reconfiguring XAMPP's Apache port, the other would be to find what's running on 8000 :).
You're using the "Bonjour" name of your server, in theory. The mysite.local name. But if it's taking more than a second to resolve, then it is obviously browsing out to the internet in order to resolve the name to an address and come back inside.


If you know how, you can take the time to investigate your Bonjour settings. If you have Wide-Area Bonjour Browsing configured, but the server on the other end is not (or is no longer), these lookup delays are not completely impractical.

The quickest fix to this problem would just be to use localhost:8080 instead of mysite.local:8080, the longer one would be to trace where exactly your DNS lookup is heading too, and determining why a multi-second lookup is occurring.