Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

timokfine's avatar

Valet 2.0 – 502 Bad Gateway

Updated to Valet 2.0. When I try to view a parked site in Chrome, I'm greeted with a 502 Bad Gateway error.

I've gone through Adam Wathan's troubleshooting guide for macOS:

https://gist.github.com/adamwathan/6ea40e90a804ea2b3f9f24146d86ad7f

  • FPM is running, there are 4 processes.
  • All three of the error logs mentioned are empty. Zero bytes.
/tmp/com.laravel.valetServer.err
/usr/local/opt/php70/var/log/php-fpm.log
~/.valet/Log/error.log

Where do I go from here? Any ideas?

0 likes
13 replies
hello@devronbaldwin.co.uk's avatar
Level 5

I ran into the same problem. I fixed it by trying a bunch of things on the gist your pasted in. After some head scratching I decided to reboot my machine like it was a Windows machine.

The problem is now fixed.

4 likes
timokfine's avatar

@devronbaldwin Fixed it for me too. I had considered trying a reboot, but I was in the middle of downloading a massive backup and couldn't until it was finished.

Thanks!

hello@devronbaldwin.co.uk's avatar

@tmartin31 no problem. The new Valet is faster but has a few issues around WordPress sites and .htaccess I think. I've reverted to 1.x for the time being. That's a 2017 problem for me.

timokfine's avatar

@devronbaldwin Oh, damn! I do a lot of WordPress development so that's bad news. Maybe I'll end up doing the same.

hello@devronbaldwin.co.uk's avatar

@tmartin31 I think it's because it uses Nginx and my WordPress configs have .htaccess files, which is Apache.

I'm sure it's not a difficult fix and there will be documentation on using WordPress with Nginx, it's not exactly a weird thing to do.

I believe you can just use Nginx to forward to Apache if you like too.

hello@devronbaldwin.co.uk's avatar

Did you try doing the PHP7 rebuild from source after removing all traces of PHP7? I'd installed mine with Homebrew so I had to do:

brew uninstall --force --ignore-dependencies php70

and then

brew install php70 --build-from-source

Pain is always the way when you try to be on the bleeding edge.

timokfine's avatar

No dice! I think I'll drop back to 1.1.22 for now and update to both PHP 7.1 and Valet 2.0 in 2017.

1 like
smnhunt's avatar

I was getting this error. I fixed it by reinstalling php-fpm and then reinstalling valet.

AhmadKarim's avatar

I am getting "502 Bad Gateway nginx/1.12.2" error but only on the the site front-end the wp-admin of the site works just fine. Any idea? I even restarted my computer and I am still getting the same error. I turned on wp_debug and I not getting anything. The site works on a production server. Its just on my local dev server where I am using valet

NBennett's avatar

Make sure PHP is running. On OSX it doesn't start by default. This fixed it for me.

brew services start php

3 likes

Please or to participate in this conversation.