Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I browse localhost in my browser when connected to the Internet, the response is slow; it takes 30 seconds or completely times out. When I disconnect from the Internet, it is blazing fast and loads instantly.

What is going on? This is very annoying. I'm using Windows 7 Home Premium with Apache installed.

No changes have been made to the system.

share|improve this question
How about your network setting ? – matzone May 14 '13 at 8:08
@matzone: What network setting? – Erwinus May 14 '13 at 13:57
Your TCP/IP setting .. I don't know much about this, but mostly occured in DHCP setting .. – matzone May 14 '13 at 16:30

What's probably going on when you are connected to Internet is that your system tries to resolve name localhost in yours ISP DNS servers.

As a solution you can define name localhost as IP address in your hosts file which is read before querying DNS servers. Since you have Windows 7 you should have required entry in C:\Windows\System32\drivers\etc\hosts file but by default it's commented out. Start Notepad as Administrator by right-clicking on it and choosing Run as Administrator. Open your hosts file and change lines:

#       localhost
#   ::1             localhost

to:       localhost
::1             localhost

Basically uncomment it by removing # from the beginning of these two lines. Save the file and test if it resolved your problem.

share|improve this answer
I appreciate your answer, but already tried that without success! One said that to remove it and the other said to add it. It makes really no sense to the problem. – Erwinus May 14 '13 at 13:56
up vote 2 down vote accepted

Al right, it seems no problem of the system itself, windows or network but remove some hidden networkcard configurations from the past and disable all WAN-miniports in the hardware configuration that increases the speed a little.

But that was not the problem causing the long delays when connected to the internet. In the php code there was some cURL code that connects to a slow site to get some additional useragent info (REST interface). Because the data was not cached and the site access slow down in time for some reason, it connects to this slow site for each part of the webpage. This caused the long delays.

Now it is cached, the problem no longer exists. Thanks for the input anyway.

share|improve this answer

You have to make sure that all entries for are placed on the same line in the hosts file. A configuration like this: localhost mysite

should be changed to: localhost mysite

This small modification has increased the speed at my Windows based system incredibly.

share|improve this answer
Can you provide some evidence for the "speed increase"?. That change will only have a tiny effect on DNS lookups. – DavidPostill Apr 12 at 13:04
I know in Linux this should not have any impact, but at my Windows setup I have struggled with this issue for months until I did the modification mentioned above. The change is dramatic. It was taking several seconds to load the page (especially first visit to site), now the pages get loaded instantaneously (no delays at all). – W.M. Apr 12 at 13:54

I know that this question has been closed but I wanted to add my experience to this knowledge base as it might help someone else that encounters, has I did, multiple problems while resolving this issue.

I also suffered from very slow localhost and while trying to resolve this issue, I experienced a lot of other complications to the resolution of this problem.

I first discovered that other software wrote their own information in my host file...

# localhost name resolution is handled within DNS itself.
# localhost
# ::1 localhost

# localhost

# # #>
# practivate.adobe practivate.adobe.newoa practivate.adobe.ntp practivate.adobe.ipp

It seems here that Adobe had something to do with my problems ... ;-)

To resolve this issue, I had to uncommented one of these lines (get rid of # sign
# localhost
And comment all Adobe lines (add # sign) before restarting my computer.

That seemed easy to do but Win7 didn't want me to save the host file saying that it was used by an other software even if I had started notepad as an administrator...?

The only way I found to edit this file was to retart my computer in safe mode (using F8 at startup), but when I tried, I found that this feature did not work on my computer (I'll need to find why later...).

The other way to start in safe mode was to preconfigure Win7 to start in Safe mode using msconfig (find the way here How to Start Windows in Safe Mode). This being done I was able to edit my host file and make proper corrections..

Don't forget, while in safe mode, to reconfigure Win7 to start in standard mode using msconfig before rebooting your computer...

After applying these corrections, my localhost regain its "vitality" and displayed all pages in a blink of an eye...

I hope that my modest contribution helps brighten your day...

share|improve this answer
dude, i think your computer is infected by a virus by downloading the pirated version of the adobe suite. All the adobe trash that is listed is to avoid adobe software can't connect 'home' to check the license. And if you want to fix this, login as administrator, not rebooting in safe mode. – Erwinus Jun 12 '15 at 2:33
@fled You have installed pirated adobe products. You cannot deny it. – Jeremy Child Aug 16 '15 at 8:02

You must log in to answer this question.

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