安装valet访问后出现 502 Bad Gateway 错误,查看~/.valet/Log/nginx-error.log错误日志提示:

connect() to unix:/Users/fidding/.valet/valet.sock failed (2: No such file or directory) while connecting to upstream

其大致原因在于php没有重启。

$ ls -lm ~/.valet
Certificates, Drivers, Extensions, Log, Nginx, Sites, config.json, dnsmasq.conf

$ brew services restart php70
==> Successfully stopped `php70` (label: homebrew.mxcl.php70)
==> Successfully started `php70` (label: homebrew.mxcl.php70)

$ ls -lm ~/.valet
Certificates, Drivers, Extensions, Log, Nginx, Sites, config.json, dnsmasq.conf, valet.sock

重启完php之后发现~/.valet/多了valet.sock文件,再次访问网站即可正常访问了。

happy coding!!!