9

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.

2 Answers2

0

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.

ion
  • 101
-1

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 http://localhost. If that fails, try one of these links:

  • http://127.0.0.1:80
  • http://127.0.0.1:8080
  • http://127.0.0.1:443
  • http://127.0.0.1:4443

Good luck!

Giacomo1968
  • 58,727