Search code examples
nginxdnsmasqconnection-refusedport80laravel-valet

Laravel Valet sites connection refused on port 80


Ever since Chrome and Safari started forcing HTTPS redirection on the .dev TLD I've been getting issues connecting to my Laravel Valet sites.

Without knowing that Chrome and Safari had done this, I updated Valet to from 1.2 and not thinking to check in Firefox first (doh! 😖). I've installed the latest stable release of Laravel Valet (2.0.6) on High Sierra (10.13.2), completely removed the running version of homebrew/php/php70 and reinstalled to be sure and have now changed the TLD to .test.

I can ping the domain without suffering any packet loss, however when I run

curl oldabp.test --verbose

I get

* Rebuilt URL to: oldabp.test/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to oldabp.test port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to oldabp.test port 80: Connection refused

I've also cleared the dns cache using the command found in this article, restarted valet and rebooted. I retested after each of these steps and the output remains the same.


Solution

  • I found a stack overflow answer for a similar question here that did the trick. During the valet install step I noticed it installed and started nginx and I don't remember it restarting nginx in the numerous times I've called valet restart before despite it telling me that it had restarted successfully. It boils down to very odd behaviour which has been resolved.