Error: Connection Refused when loading Magento backend

I just had such a facepalm moment… :man_facepalming:

I was updating one of my development servers to bring it more up-to-date with my production server. I’d copied the database across from Production > Live and pulled the latest git. Then proceeded to set everything else up.

For some reason, the frontend was loading just fine (with the exception of a couple of images). But when I loaded the backend, all I could get was this:

refused

I’ve no idea how long I spent trying to diagnose the issue… Then it clicked! Solution below…

So, it turned out that I completely forgot that I don’t have SSL (port 443) setup on my Development Server. And the database I pulled across from the Production Server is configured to load the backend of Magento via SSL!

My mind clearly wasn’t in the right place…

Anyway, super-easy to fix. I just had to make the following changes to the database (core_config table) and clear the cache:

refused02

0 = Don’t use SSL
1 = Force SSL

This ensures that Magento doesn’t try to redirect you to port 443 if you don’t have it setup.

Obviously, another way around this would be to simply setup SSL on the Development Server so that I don’t accidentally run into this again.