http://localhost/ not working

43,835

Solution 1

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

127.0.0.1       localhost

If it is not there, add it.

Solution 2

Chrome doesn't like localhost. Try http://0.0.0.0/

Solution 3

if you are using firefox, Uncheck

File > Work Offline and then try again.

Solution 4

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:
43,835

Related videos on Youtube

oshirowanen
Author by

oshirowanen

Updated on September 17, 2022

Comments

  • oshirowanen
    oshirowanen over 1 year

    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.

    • Eliah Kagan
      Eliah Kagan almost 12 years
      Did this answer (which you accepted) really solve your problem? I'm asking because you said that http://127.0.0.1 didn't work either. Whether or not localhost is properly mapped to 127.0.0.1 shouldn't affect whether or not http://127.0.0.1 works.
  • oshirowanen
    oshirowanen over 13 years
    I'm using Chromium 5.0 and don't have firefox installed.
  • saturngod
    saturngod over 13 years
  • Oli
    Oli over 13 years
    Certainly try wget localhost (or links localhost) to diagnose the issue.
  • Code.Decode
    Code.Decode over 13 years
    localhost works fine on my chromium (admittedly version 7, not 5 as the questioner is using)
  • João Pinto
    João Pinto over 13 years
    -1: localhost is just as valid as any other url, if you believe there is a bug on chrome you should elaborate.