Connection Refused on creating new VHOST on macOS

All MAMP discussions around troubleshooting and anything related to MAMP. Be as detailed as possible here when posting an issue.
Post Reply
mampsupportmod
Site Admin
Posts: 156
Joined: Wed Jan 20, 2021 3:06 am

Connection Refused on creating new VHOST on macOS

Post by mampsupportmod »

This sometimes in macOS 10.14 and MAMP. I will create a new VHOST but each time I try to browse to it I get connection refused. It doesn't matter if I bind to an IP address or not. I know it's not Apache because it's not logging any access to the directory. "Localhost" works and I see the MAMP message. It's not the macOS firewall either. If I change the ports back to default MAMP ports, I start to see Apache access logs which tells me I'm trying to make an HTTPS connection to my site but I don't have this setup in httaccess or on my host. And then that reveals something important....
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "\x16\x03\x01\x02" 400 226 "-"
___default___ ::1 - - "-" 408 - "-"
___default___ ::1 - - "-" 408 - "-"

I created a new vhost but the host name is an actual public website on the Internet and uses HTTPS. All my browsers had the HTTPS version name of that site cached. And since browsers today hide HTTPS (they assume all sites are https now) i didn't notice it in the URL bar.

Ultimately, I had to just re-create a brand new dummy http vhost because caching is annoying now.

Next time this happens, here's everything else I checked for anyone else experiencing this. Not necessarily in any order.

If you receive "connection refused" in your browsers trying to reach a new MAMP VHOST:

1. Verify HOSTS file entries are correct in /etc/
2. Verify permissions on the vhost directory are good
3. Check if another instance of Apache is running (Activity monitor -> Check for other httpd processes) when MAMP is not running, this will cause a conflict.
4. Enable Apache access logs and check to see whats happening when you browse the site. In my case, I got logs after I changed my MAMP ports per above.
5. Check the URL you're entering (HTTPS or HTTP).
MAMP Support Forums is an unofficial support forum covering MAMP & MAMP Pro solution stacks.
Post Reply