1

I installed Apache 2 on my Windows 7 box last week and all seemed to run fine. I had an issue where 'localhost' took a long time to load, but actually typing in the IP 127.0.0.1 in the address bar of my browser loaded my local websites instantly. I googled it and the solution was to comment out the IPv6 setting in the windows hosts file. Now typing 'localhost' in the address bar loads my local sites instantly.

I just added some virtual hosts in the httpd.conf file (and also to the windows hosts file) and now the virtual hosts take 4+ seconds to load. I opended the Net tab in firebug to see what part of the request was taking so long, and it shows 4.04 seconds to do the DNS lookup... I have googled and googled it and I am not sure what to do.

1
  • are the vhost domains at the top of your hosts file? have you changed the listener or anything else related to ports? Jun 27, 2010 at 1:50

2 Answers 2

2

It's supposed to be a Windows 7 conflict related with IPv6 and host resolving. There's an interesting post about this issue in this blog: http://cubicspot.blogspot.com/2010/07/fixing-slow-apache-on-localhost-under.html

In my case, I sped the thing up adding "127.0.0.1 localhost" to my hosts file. That did the trick.

1
  • Can you expand on what's on the link? If that site goes down, this answer is essentially on line, not explaining much Oct 3, 2015 at 23:42
2

just to let documented,

First of all always modify the Windows hosts (C:\Windows\system32\drivers\etc\hosts) file with any text editor (Notepad++), adding your IP and references, including your vhosts addresses.

127.0.0.1 localhost 127.0.0.1 www.your-vhost-domain.com

And what most people forget, if you are running vhosts with domains, and your server is in the same LAN you are, you must modify your client hosts file and add those lines, but pointing to your server LAN IP, otherwise when your browser lookup the DNS for the domain, you will be redirected to your router.

192.168.1.100 www.your-vhost-domain.com

Remember to configure your VHOSTS.conf file correctly as well, adding document roots and other parameters for each vhosts.. Try checking up for vhosts guides

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .