http://localhost/ not working

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 127.0.0.1 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.

1

4 Answers

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

127.0.0.1 localhost

If it is not there, add it.

if you are using firefox, Uncheck

File > Work Offline and then try again.

3

Chrome doesn't like localhost. Try

2

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.

You Might Also Like