Apache VirtualHost slow lookup
Add your virtual hosts to the first line:
127.0.0.1 localhost test.local work.local yii.local
And remove the last line.
That should do the trick. Your vhosts are now an alias for localhost. It's not a good idea to have the same IP-address in multiple lines. This just confuses the DNS-cache.
For anyone who is using Chrome and still gets slow virtual host lookup, you need to change the virtual host name to something else than .local
, eg. change test.local
to test.dev
.
Explanation and source here: http://bencrowder.net/blog/2012/10/slow-localhost-in-chrome/
What fixed it for me was editing httpd-vhosts.conf and changing all instances of:
<VirtualHost *:80>
to:
<VirtualHost 0.0.0.0:80>
It was taking about 2-5 seconds to resolve the host, now it is instant. I did not have to modify the order of my sites in my hosts file. This just makes it use ipv4 instead of ipv6 which I'd bet you don't use anyway.