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

I have a Vista laptop that I have been running Apache / MySql / Php / PhpMyAdmin on for quite some time without fail. I just use it to test bits of code here and there etc. No problems, until recently when I needed to test something and I happened to be in a place that I could not get an internet connection. Why am I unable to access localhost from the same machine without an internet connection? I am type http://localhost..etc into the browser's address bar and I get the message that I am unable to access without an internet connection. I checked my windows/system32/etc/hosts file and the first two lines are

127.0.0.1 localhost

::1 localhost

What am I missing here?

share|improve this question

migrated from stackoverflow.com Oct 9 '09 at 0:19

This question came from our site for professional and enthusiast programmers.

2  
Is the server up? Have you checked? – Vinko Vrsalovic Oct 8 '09 at 16:25
    
Do you mean http://localhost/etc? (/, not ..) – SLaks Oct 8 '09 at 16:25
    
Why do you have localhost in your hosts file twice? There should only be one entry that is 127.0.0.1 localhost – James Goodwin Oct 8 '09 at 16:29
2  
@James Goodwin - "::1 localhost" is for IPv6 – Mark Oct 8 '09 at 16:37
    
Do you use localhost when you have internet plugged in, or just when you are not connected? If so, then the problem most likely is a wrongly configured NameVirtualHost directive. – Raynet Oct 9 '09 at 0:35

Do you need to stick a loopback Ethernet plug into your ethernet port?

http://www.tikkiweb.net/loopback

http://www.thinkgeek.com/gadgets/tools/6c20/

share|improve this answer
1  
This is not required to access localhost from a web browser. – Ken White Oct 8 '09 at 16:30

I think it's just a problem with the browser. If you are on Firefox and there is no internet connection it will put you into "offline mode". Check this by going to File > Work Offline

share|improve this answer
    
It happens with both Mozilla and IE... Oh and Opera too. – robert knobulous Oct 8 '09 at 16:28
    
this seems most likely to me, assuming the OP's URL is misreported :) – quack quixote Nov 27 '09 at 20:58
    
The tcp/ip stack with loopback is started along with the configured network connection in many versions of windows. – tovare Sep 6 '10 at 20:26

This means that the Apache server is not running or you have the port configured to a different port on your machine.

Another potential issue is that the host name of apache may be different than 127.0.0.1 or localhost.

share|improve this answer

I had this issue once on an older version of windows, where I needed to dial up to make the loopback (127.0.0.1) work.

http://www.windowsnetworking.com/articles_tutorials/Install-Microsoft-Loopback-adapter-Windows-XP.html

You should be able to install a loopback adapter (software driver as described in the article above), but you might consider get a router and make your own little development network instead.

share|improve this answer

You must log in to answer this question.