valet: This site can't be reached / ERR_CONNECTION_REFUSED
Two days ago, seemingly out of nowhere, my Valet sites suddenly had all stopped working. If I try to load any of them in a browser I just get:
(Chrome) This site can’t be reached cufm.test’s server IP address could not be found.
(Firefox) We can’t connect to the server at cufm.test.
Over the past two days I’ve tried absolutely everything I could find in previous similar issues, but nothing seemed to fix it on my machine. I ultimately even wiped the entire machine and restored a Time Machine backup from last week (when things were working). But even that somehow didn’t fix the issue.
Running valet uninstall --force
fails with a The process has been signaled with signal "9".
error, but trying any of the fixes mentioned in #876 don’t fix that issue for me. So I’ve attempted a manual uninstall and reinstall with:
valet unsecure --all
rm -rf ~/.config/valet
composer global remove laravel/valet
brew uninstall --force php nginx dnsmasq
sudo rm -rf /usr/local/Cellar/php/7.4.12
brew update
brew upgrade
brew cleanup (no issues)
brew doctor (no issues)
brew install php
composer global require laravel/valet
valet install
No luck, so I decided to remove Homebrew and Composer completely and just start over from scratch:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew upgrade
brew install php
rm /usr/local/bin/composer
rm -rf ~/.composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
composer global require laravel/valet
valet install
cd ~/Sites
valet park
Still nothing, same issue as before. When checking the logs, ~/.config/valet/Log/nginx-error.log
is empty and /usr/local/var/log/php-fpm.log
shows:
NOTICE: fpm is running, pid 72876
NOTICE: ready to handle connections
Running valet uninstall --force
still fails with a The process has been signaled with signal "9".
error.
I’m out of ideas, but really hoping someone can point me in the right direction.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 88 (49 by maintainers)
PSA / Reminder: A lot of Valet “issues” are caused by outdated dependencies. Running
brew upgrade
andcomposer global update
at least monthly is a wise housekeeping practice.We’re all back to normal. For anyone finding this in the future, I’m not a 100% sure what combination of changes ultimately fixed the issue, but I’m pretty sure the issue was originally caused by the installation of ExpressVPN and ultimately solved again by a fresh installation of ExpressVPN.
@drbyte thank you so much for hanging in there and being relentless in trying to track down the issue. It’s very much appreciated!
Had similar issue – after some OS updates and cleanups, reinstalling Valet / Nginx / PHP etc everything worked and then suddenly stopped working, throwing
ERR_NAME_NOT_RESOLVED
. This thread helped to figure out that dnsmasq might not be working properly. Removing it and installing viavalet install
again as suggested by @drbyte fixed the issue. Thanks!Thanks for starting off with a thorough initial incident report. That makes providing help soooooo much easier!
Glad you got it sorted out.
Yup, port 60 responds just fine:
Links to
lrwxr-xr-x 1 0 0 22 21 Nov 2019 /etc/resolv.conf -> ../var/run/resolv.conf
/etc/resolv.conf:
Among other things, I’d be exploring:
brew services list
- what’s it saying about dnsmasq? Should be running as root, with no errorswhat are your system’s resolvers set to? In System Preferences, Network, Wifi, DNS, what are the DNS Servers? If
127.0.0.1
is not there or not first in the list, do you have an intentional reason?ping foo.test
- what’s the outputYou said this all started “2 days ago”. What changed on your mac 2 days ago? Reboot? Software upgrades? Software installs? New apps? Removed apps?
does
/private/etc/resolver/test
exist? what’s in it? It should saynameserver 127.0.0.1
inside.You could enable dnsmasq logging by creating
/Users/mike/.config/dnsmasq.d/config-logging-on.conf
containing:(delete the file or rename it without a
.conf
extension when you don’t need logging anymore; the file gets large fast)After that, does running
valet tld test
solve the problem? This is valet’s default, but if part of the config for it has been damaged perhaps this might reset it.