dfgdghjezfghfgdh
dfgdghjezfghfgdh

Reputation: 21

Valet 502 Bad Gateway

valet is not working after I updated php from 7.3 to 7.4. I already tried to reinstall valet, php, nginx and dnsmasq but it's still not working. Now the ngix server is running but I can't acces to my projects. I get the error 502 Bad Gateway for every project url.

The services are running but brew services dont show the correct status.

dnsmasq       unknown root      /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
gitlab-runner started user      /Users/user/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist
[email protected]     started user      /Users/user/Library/LaunchAgents/[email protected]
nginx         unknown root      /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php           error   root      /Library/LaunchDaemons/homebrew.mxcl.php.plist
[email protected]       unknown root      /Library/LaunchDaemons/[email protected]
redis         started user      /Users/user/Library/LaunchAgents/homebrew.mxcl.redis.plist

Nginx error log

2021/01/27 16:35:21 [crit] 35081#0: *1 connect() to unix:/Users/user/.config/valet/valet.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/Users/user/.config/valet/valet.sock:", host: "devtest.test", referrer: "http://devtest.test/"

Upvotes: 2

Views: 5425

Answers (1)

Jon White
Jon White

Reputation: 1010

I've managed to get mine working again.

I started by doing a full wipe down following the instructions that valet gives when you run valet uninstall which involved removing valet and all associated config, uninstalling php, nginx and dnsmasq via brew and cleaning up all remaining config. I then reinstalled everything, reconfigured my sites in valet and tried to load one up. Still I got the 502 Bad Gateway error.

I eventually tried running valet use php to make sure it was correctly bound to the right php version. Valet claimed that is was but I ran it again with the force flag just in case valet use php --force.

After that I was up and running again. Hopefully this might help you too.

What's strange is that my brew services list output lists dnsmasq, nginx and php as status unknown but they do all seem to be running correctly. I can't work out what's happening there but at least everything seems to be working again now.

Upvotes: 3

Related Questions