Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
are the vhost domains at the top of your hosts file? have you changed the listener or anything else related to ports? –  davidosomething Jun 27 '10 at 1:50
add comment

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.