Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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've just done a fresh install of Ubuntu (10.04.1) plus LAMP (via sudo tasksel install lamp-server) and everything is working fine. However, it does so until I need to work on localhost when I do not have an internet connection. For example, as soon as I unplug the ethernet cable from the NIC, localhost and stop working.

The message I get from the browser is:

This web page is not available.

Then, as soon as I plug the ethernet cable into the laptop again, everything is back to normal again. I need to work on localhost sometimes when I do not have access to the internet.

Any idea how to fix this problem? I had this problem before, but can't remember what I did to resolve it.

share|improve this question
Did this answer (which you accepted) really solve your problem? I'm asking because you said that didn't work either. Whether or not localhost is properly mapped to shouldn't affect whether or not works. – Eliah Kagan Jun 17 '12 at 7:36
up vote 6 down vote accepted

Check that you have this line in /etc/hosts:       localhost

If it is not there, add it.

share|improve this answer

if you are using firefox, Uncheck

File > Work Offline and then try again.

share|improve this answer
I'm using Chromium 5.0 and don't have firefox installed. – oshirowanen Aug 23 '10 at 9:26
may be chrome issue. – saturngod Aug 23 '10 at 9:37
Certainly try wget localhost (or links localhost) to diagnose the issue. – Oli Aug 23 '10 at 10:55

Chrome doesn't like localhost. Try

share|improve this answer
localhost works fine on my chromium (admittedly version 7, not 5 as the questioner is using) – 8128 Aug 23 '10 at 12:37
-1: localhost is just as valid as any other url, if you believe there is a bug on chrome you should elaborate. – João Pinto Aug 23 '10 at 20:58

Update: The newest versions of Google Chrome have fixed this issue. It should be working now.

It sounds like you're using Google Chrome or Chromium - This is a bug in Chrome that I've been meaning to report (but never got around to it). Google Chrome attempts to automatically detect a "Working Offline" status and will not allow the user to easily change it

Unfortunately with Chrome right now, you must be connected to some form of network to use localhost.

share|improve this answer

protected by Oli Sep 10 '12 at 14:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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