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.
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).

Few questions:
Did you run valet install after upgrading to 2.0.3?
Can you post the contents of the following files?
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/valet/valet.conf
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
user Darek staff;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
include /Users/Darek/.valet/Nginx/*;
include servers/*;
include valet/valet.conf;
}
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
internal;
alias /;
try_files $uri $uri/;
}
location / {
rewrite ^ /Users/Darek/.composer/vendor/laravel/valet/server.php last;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /Users/Darek/.valet/Log/nginx-error.log;
error_page 404 /Users/Darek/.composer/vendor/laravel/valet/server.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/Users/Darek/.valet/valet.sock;
fastcgi_index /Users/Darek/.composer/vendor/laravel/valet/server.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /Users/Darek/.composer/vendor/laravel/valet/server.php;
}
location ~ /\.ht {
deny all;
}
}
P.S. While you were replying I updated my original question/issue with screenshots.
I have also uninstalled Valet entirely, nginx, updated php to 7.1 etc.
Also tried with dev-master. Now on dev-master, not on 2.0.3
Anything in the nginx logs?
This appears after accessing /login.
2016/12/18 18:55:26 [error] 38115#0: *1861 rewrite or internal redirection cycle while processing "/Users/Darek/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /css/app.css HTTP/1.1", upstream: "fastcgi://unix:/Users/Darek/.valet/valet.sock", host: "laravel53.dev", referrer: "http://laravel53.dev/login"
2016/12/18 18:55:26 [error] 38115#0: *1862 rewrite or internal redirection cycle while processing "/Users/Darek/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /js/app.js HTTP/1.1", upstream: "fastcgi://unix:/Users/Darek/.valet/valet.sock", host: "laravel53.dev", referrer: "http://laravel53.dev/login"
2016/12/18 18:55:27 [error] 38115#0: *1863 rewrite or internal redirection cycle while processing "/Users/Darek/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /js/app.js HTTP/1.1", upstream: "fastcgi://unix:/Users/Darek/.valet/valet.sock", host: "laravel53.dev", referrer: "http://laravel53.dev/login"
2016/12/18 18:55:28 [error] 38115#0: *1864 rewrite or internal redirection cycle while processing "/Users/Darek/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/Users/Darek/.valet/valet.sock", host: "laravel53.dev", referrer: "http://laravel53.dev/login"
If you want, I can valet share you the site with phpinfo(); or something :)
Oh. I have forgotten to mention I am still using Yosemite. May that be an issue?
Have the same problem. Try valet uninstall && valet install. I don't have an idea about that but it works on my macOS. Good luck.
@dodyagung I have already tried a few times. No change.
@DCzajkowski I can't know for sure but I wouldn't be surprised if the issue was related to being on Yosemite. Unfortunately there's no reasonable way for me to try and reproduce that locally :/
If you like, I can make time for a screenshare at some point if you want to try and troubleshoot it together.
Sure. Whenever you can :)
@maxvaser This issue is about static assets returning a 500, not about file size. Did you mean to post in another issue?
Sorry, there is already one started. this issue was referenced to verify that the .conf files were indeed updated. I'll move those to the other issue #253 .
FWIW I have the same issue in El Cap as well. Same log entires, too:
2016/12/19 11:38:17 [error] 15618#0: *1574 rewrite or internal redirection cycle while processing "/Users/jeremy/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /wp-content/uploads/2016/12/17-300x200.png HTTP/1.1", upstream: "fastcgi://unix:/Users/jeremy/.valet/valet.sock", host: "gdi-wp.dev"
2016/12/19 11:38:21 [error] 15618#0: *1714 rewrite or internal redirection cycle while processing "/Users/jeremy/.composer/vendor/laravel/valet/server.php", client: 127.0.0.1, server: , request: "GET /wp-content/uploads/2016/12/17-300x200.png HTTP/1.1", upstream: "fastcgi://unix:/Users/jeremy/.valet/valet.sock", host: "gdi-wp.dev"
Tried uninstalling + reinstalling nginx per your suggestion, as well as uninstalling and reinstalling valet
EDIT:
Changing /usr/local/etc/nginx/valet/valet.conf from:
location / {
rewrite ^ /Users/jeremy/.composer/vendor/laravel/valet/server.php last;
}
to
location / {
try_files $uri $uri/;
rewrite ^ /Users/jeremy/.composer/vendor/laravel/valet/server.php last;
}
Fixed the issue for me - I have no idea if that's a remotely valid fix, but it made it so I could get back to work, at least.
Did you restart nginx or something after the change to /usr/local/etc/nginx/valet/valet.conf?
For me it helped with updated settings in /usr/local/etc/nginx/valet/valet.conf
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/Users/{username}/.valet/valet.sock;
fastcgi_index /Users/{username}/.composer/vendor/laravel/valet/server.php;
# added params:
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
# /added params
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /Users/{username}/.composer/vendor/laravel/valet/server.php;
}
Don´t forget to replace {username} with your username!
And a valet restart after edit...
Thanks @ekandreas, but it still didn't work for me (changed /Users/aek to /Users/Darek accordingly) :/
Don't change other than just the two params...?
Oh, ok. Still same thing though.
Sorry, have you tested the other examples in the source?
Yes, I have. Although my problem (I think) is not with a file size or sth, but with a 500 error.
When I removed everything from the app.css file the problem still persists, so it can't be a file size, can it?
I definitely don't think it's related to file size but I'm not sure what the problem is yet :/
If you had some time for a screen-share just drop me a message. Thanks for your help BTW :)
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
I have the same problem. Any solution now?
UPDATE:
Problem solved after I reboot my mac....WTF
All of the guys having the same problem please edit your posts to include a Mac version, and have you installed or updated Valet. Also feel free to include any additional information.
I'm on El Capitan and following @EHLOVader recommendation solved the issue.
valet stop
brew uninstall nginx
brew install nginx --with-http2
valet install
I tried restarting my machine before running these command but that alone didn't work.
valet stop
brew uninstall nginx
brew install nginx --with-http2
valet install
This fixed mine on El Cap as well...
Make sure you have a valet.sock file:
ls -la ~/.valet/valet.sock
And you should have

Make sure it's really a socket, that first "s" tells you that.
Make sure php-fpm is running:
ps aux | grep php
Should give you something like:

Make sure you have no errors on PHP no Nginx, by looking at your logs while running valet restart:
sudo tail -f /usr/local/var/log/* /usr/local/var/log/nginx/* ~/.valet/Log/* /usr/local/opt/php71/var/log/*
And you should get

In my case it was xdebug wrongly configured in php-fpm.conf. FPM was not starting at all.
A missing valet.sock file opened my eyes.
These are the outputs of commands you have suggested:




Although there is nothing especially interesting about those outputs, this one is very interesting indeed:

@DCzajkowski, looks like there's something listening on port 80, check using:
lsof -i :80 | grep LISTEN
If it's NGINX, completely stop it:
running as root
sudo brew services stop nginx
and also as your user
brew services stop nginx
Then restart valet
valet restart
And you have another error [emerg] "http" directive is not allowed here … for that one check if you don't have any nginx configuration files doing that, like a backup file. You can try to disable some of the includes in nginx.conf to see if it loads:
include /Users/antoniocarlos/.valet/Nginx/*;
include servers/*;
include valet/valet.conf;
Check if you have any files in those dirs, they might be causing it too, becaus they are loaded before valet.conf.
hi guys! i've a similar problem...

when i load my repo randomly give me 502 bad gateway or it drop some stylesheets or js
I had a similar issue this morning but a cd ~/.valet && valet install && valet restart solved the problem. I think it would be helpful for Valet to flag when it requires an install. I don't even know it's updating as the alias I run updates Valet alongside a thousand other items.
I've encounter this too. Don't know why but doing valet install just completely broke… well everything for valet. So I
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
sudo brew services restart nginx
sudo brew services restart php71
sudo brew services restart dnsmasq
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 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.
Yeah, that's something I tried too. Unfortunately the file permissions wouldn't actually _fix_ themselves which is why I had to go through those steps. I would think that sudo brew … would auto fix the files but it didn't for me.
Yeah I found I could keep the default file permissions if I just manually stopped and started my services vs. using restart.
I was under the impression daemons plist files handled by launchctl had to be root:wheel if they're launched with sudo like they are w/ brew but I'm not a macOS developer so I could be wrong. But hey if that worked for you it might work for others. Worth a shot I guess.
Yeah literally just trial and error until something worked. It seemed really weird to me that root wouldn't be able to properly restart a service owned by a less-privileged user :/
Yeah, I noticed that too. Seemed really strange. Got mine in a position where I had to manually kill some nginx processes because brew was _convinced_ that it wasn't running as me or root.
It is incredible and impossible at the same time. I haven't changed anything, I haven't updated anything. I don't even remember rebooting since. Yet, recently everything started working back as it should. Both static files and https.
Now. It started working for me, but what about others? Feel free to close this issue if you feel like doing so. Cheers! :)
i'm in the same situation
Never mind. Still doesn't work :/
I had the aforementioned problem 3-4 times already on even latest version.. It works okay, then one time 500 error on all static files enters. I reinstall valet and all works okay again... Until it breaks)))
Same issue :(
@DCzajkowski if it is still not working try running this command.
sudo apachectl stop then reboot. see if it all starts to work. It sounds like apache and ngnix are fighting for port 80
This is from February 2017. I am now on 2.3.0 and running Mojave. Everything works as expected. I am not sure what was the issue, but I closed this on September 2017, so it must have worked back then. Thanks for the advice anyway
Most helpful comment
Few questions:
Did you run
valet installafter upgrading to 2.0.3?Can you post the contents of the following files?
Did you have nginx already installed via homebrew before installing Valet? It needs to be installed with the
--with-http2flag 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: