valet: [Valet 2.0.3] 500 Bad Gateway on every static file

Hello. In the newest Laravel Valet any time I access any site assets are not being loaded e.g.

laravel new test
cd test
php artisan make:auth

Navigate to test.dev site is working. When I click on Login on /login no assets are being loaded and every one of them gets 500 error.



In #242 it was sending 404 along with the response. Now it is not sending anything, just an nginx error.


In the mean time

At the same time valet secure did not work at all (every site served over https resulted in “This site can’t be reached” or something like that).

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 49 (12 by maintainers)

Most upvoted comments

I too had the same problem. It may have been due to nginx being installed previously.

Following the instructions to install with the --with-http2 flag worked for me.

valet stop
brew uninstall nginx
brew install nginx --with-http2
valet install

Few questions:

  1. Did you run valet install after upgrading to 2.0.3?

  2. Can you post the contents of the following files?

    /usr/local/etc/nginx/nginx.conf
    /usr/local/etc/nginx/valet/valet.conf
    
  3. Did you have nginx already installed via homebrew before installing Valet? It needs to be installed with the --with-http2 flag for HTTPS to work properly. Valet will install it using that flag for you if it’s not already installed, but if it was already installed, try:

    valet stop
    brew uninstall nginx
    brew install nginx --with-http2
    valet install
    

Never mind. Still doesn’t work 😕

I actually had a similar problem last night where brew services restart wasn’t working properly, but stop then start always worked. Related to permissions for those same files you changed.

I pushed a “fix” for this on the master branch:

https://github.com/laravel/valet/commit/3027a0dbbac35e8ae1ca93475835bd611c4ea25e

If anyone wants to update to dev-master and see if that fixes anything for them I’d be interested in hearing about it.

I’ve encounter this too. Don’t know why but doing valet install just completely broke… well everything for valet. So I

  1. removed and reinstalled PHP 7.1 and nginx
  2. Fixed the permissions on ~/.valet/Log to make it and all files inside writable by my user
  3. Ran this:
sudo chown root /usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist
sudo chown root /usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist
sudo chown root /usr/local/Cellar/dnsmasq/2.76/homebrew.mxcl.dnsmasq.plist

sudo chgrp wheel /usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist
sudo chgrp wheel /usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist
sudo chgrp wheel /usr/local/Cellar/dnsmasq/2.76/homebrew.mxcl.dnsmasq.plist
  1. And this:
sudo brew services restart nginx
sudo brew services restart php71
sudo brew services restart dnsmasq
  1. And this
sudo killall mDNSResponder

And everything started working correctly. (and valet restart works as expected) It appears that the permissions for newly installed launch daemon plists are either broken or I did something strange.

I realize these steps are close to nuclear (you’ll have to setup your valet settings again, a la valet domain and valet park) but I figured that I’d put them here if it happens to help someone. I think I got all the steps down. Let me know if these don’t seem to help. There was a large amount of intermediate debugging and “what the heck is going on” for the last hour or so.

I have the same problem. Any solution now? UPDATE: Problem solved after I reboot my mac…WTF