Cannot connect to localhost - ERR_CONNECTION_REFUSED
Posted by: mike220 (---.dsl.dynamic.sonic.net)
Date: March 19, 2023 07:29PM

I have been happily using WAMPSERVER for 10 years and suddenly a few days ago I can no longer reach localhost on my machine. The only change to my configuration was a Windows 10 update to 19045.2728. I have worked on this for at least 10 hours, following as many suggestions as I can find online and none have worked. Here's a description of the problem, my configuration and what I have tried so far. If I have been affected by this update, I suspect others have too.

Emotional plea - I really hope someone has a suggestion or two.

PROBLEM
I get the error ERR_CONNECTION_REFUSED, when going to [localhost]. (The URL jumps over to [localhost], not sure that matters or if that is different than before the Windows update).

WHAT WORKS:
Pings to localhost and 127.0.0.1
All the lights are Green in wampserver (full wampserver configuration is shown below).

WHAT I'VE TRIED SO FAR
A. With my original installation of wampserver which has been installed and running successfully since mid 2022:
1. Uninstalled the latest Windows 10 update. Unfortunately, MS does not allow this update to be fully removed. This update took me to Windows 10 19045.2728
2. Changed port number for Apache from 80 to 8080. In httpd.conf and httpd-vhosts.conf
3. Disabled the windows firewall
4. Cleared browser cache
5. Tried 127.0.0.1 instead of localhost
6. Tried adding :80 or :8080 after [localhost]
7. Tried different browsers (chrome, mozilla, bing)
8./ Flush the DNS (ipconfig /flushdns)
9. Restart WAMP services
10. Moved to Windows 11 with the hope of fixing it, but to no avail so I came back to 10.

B. With a fresh installation of wampserver
(Given the genesis of this error, it is unlikely that it has anything to do with wampserver, but installing a new version reflects my level of desperation.)
Same error as before. Unable to reach localhost. No changes to the default configuration including the location of localhost (DocumentRoot "${INSTALL_DIR}/www"winking smiley

ANSWERS TO REQUIRED WAMPSERVER QUESTIONS for making a post on this site:
1 - Windows version used (Specify version number AND whether 32 or 64 bit)
>> Windows 10, build 19045.2728, 64 bit

2 - Version WampServer (Specify version number AND whether 32 or 64 bit)
64 bit, 3.3.0

3 - Apache Version
>> 2.4.54.2

4 - PHP Version
>> 8.2

5 - MySQL Version
>> 5.2

6 - What color is the WampServer icon (in the notification area of the taskbar)
>>GREEN

7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines?
127.0.0.1 localhost
::1 localhost

If the WampServer icon is green:

8 - Do you have access to localhost (Homepage WampServer)?
NO!

8a - If so, is there an error message at the bottom of the page?
Error is "ERR_CONNECTION_REFUSED"

9 - Do you have access to phpMyAdmin?
YES, to [localhost]

10 - If you refer to an error message, please include the EXACT wording of the error in your post
>> Done, see #8a

11 - If you use an Antivirus and / or Firewall, please include the names of these
>> Windows Antivirus and Firewall. With Windows 10 there are Firewalls 3: Domain Network, Private Network, Public Network. All 3 have been disabled.

12 - What is the full path to the installation of WampServer (eg D:\wamp\)
C:\wamp64

13 - If you have one or more Virtual Hosts defined, please show their definition(s)
Only
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">



Edited 2 time(s). Last edit at 03/19/2023 07:50PM by mike220.

Options: ReplyQuote
Re: Cannot connect to localhost - ERR_CONNECTION_REFUSED
Posted by: Otomatic (Moderator)
Date: March 20, 2023 08:40AM

Hi,

You are the second person on this forum to have this problem for which I have no solution at the moment.

Very strange problem since 'http://localhost/phpmyadmin/' works perfectly.

It would be interesting to know if 'http://localhost/add_vhost.php' works or not as well as 'hhtp://localhost/index.php'

Do you use VPN or proxy ?

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Cannot connect to localhost - ERR_CONNECTION_REFUSED
Posted by: mike220 (---.dsl.dynamic.sonic.net)
Date: March 20, 2023 04:24PM

First off, thank you very much for commenting on this. Your comment let me down the path to fixing it!

Because this works: [localhost]
And the the https version doesn't

It made me consider the .htaccess file, which I'd removed numerous times during my testing previously. But I believe the browser cached it so I didn't see any change after removing it so I figured that wasn't the problem. But this time, after removing it, I was able to get to "http localhost" and not have it switch over automatically to https. And now I am back in action! Sanity prevails! Thank you * 1000!

Options: ReplyQuote
Re: Cannot connect to localhost - ERR_CONNECTION_REFUSED
Posted by: Otomatic (Moderator)
Date: March 20, 2023 05:22PM

Hi,

> Because this works: 'http://localhost/phpmyadmin/'
> And the the https version doesn't
It is quite complicated to put phpmyadmin in https because it is necessary that localhost is in https AND that MySQL is also in secure ssl connection.

On the other hand, the VirtualHost other than localhost can be put in https ssl mode, the procedure to do it is here :
How to activate https ssl in Wampserser

You have to be careful with the .htaccess files that can force the https mode and you have to be very careful with some browser settings that can force the https mode and, of course, if it is not available for the requested local site, there will be an error.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Cannot connect to localhost - ERR_CONNECTION_REFUSED
Posted by: darthpathos42 (---.dsl.bell.ca)
Date: March 21, 2023 12:16AM

…I have a web application that I’ve just finished upgrading (PHP8.1.16, Apache 2.4.55.2, WAMP 3.3.4, Windows 2019 Datacenter) and things have been fine until today when I started running into odd issues (specific pages not accessible, for example). Error in Apache Log indicated the cert name didn’t match the Apache conf file; I’ve tried changing httpd.conf, httpd-ssl.conf and -vhosts.conf without luck. I did not try the .htaccess file so thank you for this - I’m hoping that this fixes it.

Really annoying that this came out of nowhere.

Appreciate your time and hope this fixes the issue!
Chris

Options: ReplyQuote


Sorry, only registered users may post in this forum.