Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

127.0.0.1 is accessible/working but localhost not accessible/ not working

I am using wamp for few years and i upgraded to windows 8 few months before, my wamp working smoothly up to yesterday. But now it can't be accessed using localhost. but when i trying 127.0.0.1 instead it works smoothly. I changed ::1 localhost to 127.0.0.1 localhost in host file. which where the solution suggested for this problem in most websites. But unfortunately its not work for me. When i ping localhost its showing replay from ::1: time<1ms. And There is no software's using port 80 i already checked it. please help to solve this.

like image 434
JOE Avatar asked Dec 03 '13 07:12

JOE


People also ask

Is 127.0 0.1 and localhost the same?

Localhost is often considered synonymous with the IP address 127.0. 0.1.

Why is localhost not loading?

The localhost simulates a web server running on your computer. When the “localhost refused to connect” error appears, it is likely due to misconfigured port. Other common reasons include insufficient permissions and the Apache webserver not running properly.

How do I activate localhost 127.0 0.1 on my PC?

If you want to connect to your own computer, you can do so like any other IP address. Open up your web browser and type 127.0. 0.1 into the address bar, then press Enter. If you can't remember numbers very well, you can type localhost instead.

Why localhost is not opening in Chrome?

Go to Chrome setting > Privacy and Settings > See all the cookies and site data, search for localhost and delete it. Then refresh your site it will be working.


2 Answers

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
like image 120
VivekDev Avatar answered Sep 22 '22 23:09

VivekDev


Edit

%SystemRoot%\system32\drivers\etc\hosts

and replace

::1 localhost

with

127.0.0.1 localhost

Save and restart apache. Hope it will work .

like image 36
user2310209 Avatar answered Sep 25 '22 23:09

user2310209