1

My http://localhost is not working. But the address http://127.0.0.1 is working fine. I have multiple webservers installed on my computer and it is the same problem with them all.

I think, but I don't know, that the problem started when I installed IIS, but I have inactivated IIS now.

I am using Windows Vista. How can I make http;://localhost working again?

1
  • Can you be more specific about "not working"? Do you get an error message?
    – coneslayer
    Jul 22, 2010 at 13:23

2 Answers 2

12

Check your hosts file - this is where host names are resolved in first place. Normally, you should find this line there:

127.0.0.1 localhost

If not, add this line, save it and then test again, whether it works.

The hosts file can be found at: %WINDIR%\system32\drivers\etc

You can edit this file with any text editor (e.g. notepad).

3
  • You beat me to it! ;) +1
    – Pylsa
    Jul 22, 2010 at 13:39
  • Its name is hosts, not host. Jul 22, 2010 at 14:13
  • Also.. sometimes things "trip out" and require a reboot after making this edit. Apr 17, 2021 at 1:52
0

Mine is Ubuntu 20.04 VM

I had this following line.

::1     localhost ip6-localhost ip6-loopback

I commented that line and added the following line.

::1     ip6-localhost ip6-loopback

Basically removed

::1     localhost

It now works.

The final look of the hosts file is as follows.

127.0.0.1       localhost
127.0.1.1       vagrant.vm      vagrant

# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
::1     ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.2.1 w1 w1

You must log in to answer this question.

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