Chrome Localhost Connection Refused

Chrome Localhost Connection Refused

This question is not a duplicate because the suggested duplicate does not solve this problem. There is no such flag on chrome://flags/.

I'm using the Google Chrome web browser and WampServer to locally host a website. When I try to see my website on the localhost address in Chrome I'm getting the error ERR_CONNECTION_REFUSED. When I type the IP address 127.0.0.1 instead, the result stays the same.

On the other hand, if I enter localhost into the address bar on Internet Explorer I'm getting the expected result: The webpage displayed.

How do I make Chrome's localhost work? It may be some sort of security measure but to me it's rather an annoyance than anything else.

8

2 Answers

For me, it usually worked after a reboot .. or several, but finally took some time to look up the possible reasons. These are what I encountered - using Mac OSX.

1) Domain name - localhost is common and a must working name, I personally used .dev domains until it became a top-level domain with forced https If you're using a local domain, make sure the DNS is pointing to the localhost address (127.0.0.1). You can open a terminal and run:

ping mydomain.unnamed If not working then check your hosts file.

2) Apache syntax errors - Run httpd -t to check syntax, also make sure you do have the domain showing up in vhosts httpd -t -D DUMP_VHOSTS

3) Apache port 80 or 443 blocked - Either by firewall or other applications, so check ports:

lsof -i:80 with kill -9 (lsof -ti:80),also restart the apache service.

4) Invalid SSL certificate - For https localhost domains, renew certificates or re-add them to the Keychain.

5) Less common - Chrome extension that controls networking and probably forgotten about setting it, disable it and test.

Open command prompt as Administrator and type these two commands one by one:

netsh advfirewall firewall add rule name="TCP Port 80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="TCP Port 80" dir=out action=allow protocol=TCP localport=80

After doing so, restart the Wamp server and try to access . If that fails, try one of these links:

Good luck!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.