Laravel Valet 502 Bad Gate Way nginx/1.15.7 Laravel Valet 502 Bad Gate Way nginx/1.15.7 laravel laravel

Laravel Valet 502 Bad Gate Way nginx/1.15.7


If you're anyone like me who're seeing 502 Bad Gateway while using Laravel Valet after updating it composer global update to the latest version, you most probably forgot to run valet install command. Laravel Valet requires (in most cases) to run valet install command after updating to the latest version.


Had the same symptoms after updating to php 7.3 and then installing a new Laravel project.

It appears that brew install php73 doesn't install php-fpm

Solution is to uninstall php

brew uninstall php73 brew uninstall php72brew uninstall php71 ... whatever versions you havebrew uninstall --force php

Now reinstall php

brew install php --build-from-source

I encountered permission errors mkdir: /usr/local/etc/php/7.3/php-fpm.d: Permission denied so sudo chown -R: <yourusercode> /usr/local/etc/php fixed that and then brew install php --build-from-source again. Once it builds php 7.3 successfully reinstall valet:

valet install


None of the above answers worked for me, but found the solution here: https://janostlund.com/2019-06-20/502-bad-gateway-laravel-valet

~/.config/valet/Log/nginx-error.log shows:

[error] 17423#0: *1 upstream sent too big header while reading response header from upstream [...]

Solved by adding two lines to http in /usr/local/etc/nginx/nginx.conf

http {  fastcgi_buffers 16 16k;  fastcgi_buffer_size 32k;    //...}

and then running valet restart