I have a bunch of sites set up on my local development environment. Out of those sites I have two sites where I experience horribly slow page load times. Horribly slow, like approximately 5 minutes. The thing is my computer (mac pro osx 10.6, dual xeon nehalem processors, 6 gb of ddr3 memory) is adequately equipped and the other sites load real quick. I know its not a programming issue because the slow sites are fast on their production servers. Also these sites are just straight up PHP and MySQL stuff, no advanced frameworks or anything. These sites are configured the same way as all the other quick sites on my local machine and the same as what I've done on other dev environments where i haven't experienced the same issue, same version of Zend Server CE, PHP, and OSX. This problem is severely affecting my productivity working on these sites. I sincerely hope you guys have some in开发者_运维技巧put :-D
First, check to see if using a "standard" TLD makes a difference. Lots of developers use ".dev" or ".local" as TLD within their local environment. Sometimes these can lead to long timeouts. Switch to a standard TLD—pick any one that won't cause a conflict for you—and see if that helps.
If you're still having issues, note that OS X Lion may place DNS servers ahead of your local /etc/hosts file when resolving names! Try scutil --dns
to see where domain : local
appears in the sequence.
If "local" not #1 then see: http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/ for resolution under the heading "Solution: DNSMasq". The solution given here—along with using a standard TLD worked well for me.
(I've also seen alternative solutions, e.g., http://clintberry.com/2011/05/wildcard-sub-domains-on-osx-web-development-on-localhost/, but have not tested them.)
To fix the issue, you have to add the ipv6 version also or it takes forever...
/etc/hosts
127.0.0.1 yoursite.local
::1 yoursite.local
The ::1 line will fix your issue!
精彩评论