How to fix 502 Bad Gateway with Laravel Valet

Bryan Siegel
April 22, 2020

Laravel Valet is awesome. Once installed you can navigation to an application folder and access it with .test in the browser. Unfortunately, it only works on the Mac for the moment. It’s an easy way to quickly start up a php application on Nginx. I wrote an article on how I use Laravel Valet on WordPress applications a while back. I wanted to do some Laravel development this morning when I got a 502 Bad Gateway error while trying to access my laravel7 testing application because it’s time for me to get back to the real world and work on my Laravel skills.

Below are the steps that I took to fix the 502 Bad Gateway with Laravel Valet

Step 1 Restart Everything

Before you do anything crazy restarting php (if you installed it via brew) and Nginx could be your issue. I would highly recommend that you start with that first.

sudo brew services restart nginx && sudo brew services restart php
valet restart

Or you can start all of brew services with one command.

brew services start --all

If that doesn’t work the next thing you should do is to uninstall valet and reinstall it.

Step 2 Reinstall Valet

valet unistall
valet install
valet park

And Vala Laravel Valet should be working again. Keep in mind these are the steps that I took to fix my issue and your mileage may vary.

Tags

Web Development

Would you like to hire me?

Side projects, Employment Opportunities, you want to give me a [big bag] of money.

Contact