There seem to be a few questions that are similar but could not find the answer.
An hour ago (and the months before that :-)) everything was working fine. It looks like after updating to XCode 9.2 things stopped working.
I've justed updated to MacOS High Sierra 10.13.2 as there were some Apache updates included, but it didn't solve the issue. Maybe the XCode update changed something to the httpd.conf file? I'm not too familiar with the settings in there, so I'm unable to determine if something changed in that file.
Error in Chrome:
This site can’t be reached
www.example.dev refused to connect.
ERR_CONNECTION_REFUSED
My setup:
MacOS High Sierra 10.13.2
MAMP Pro 4.2 (latest version)
Ports are Apache: 80 and MySQL: 3306
VPN is off
If I run sudo nano /private/etc/hosts
it has the following entries (I run my local website on www.example.dev)
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 www.example.dev # Note; I added this myself a long time ago as else the URL including www doesn't work
127.0.0.1 example.dev # MAMP PRO - Do NOT remove this entry!
::1 example.dev # MAMP PRO - Do NOT remove this entry!
What I tried:
apachectl configtest
in terminal it returns Syntax OK
UPDATE
Just saw that if MAMP Pro is off:
Syntax OK
with apachectl configtest
When I run sudo apachectl stop
it returns /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service
UPDATE 2
Out of frustration I downloaded Firefox to check and... all my local dev sites work there! In Chrome I still get the same error, even after clearing browsing data.
Turns out, Chrome (and Safari as well) were redirecting to https, so https://www.example.dev. And the problem was the .dev TLD.
If you run into the same problem (force forward by Chrome to https) and: