Reputation: 37
I've been using laravel homestead for quite sometime . However the last time I created a project I got this error with the latest vagrant and laravel homestead
I've tried changing the php version as most forums with the same problem but to no avial
502 Bad Gateway nginx/1.15.6
Upvotes: 2
Views: 1298
Reputation: 11
I had a similar problem. I solved it as follows:
vagrant ssh
vagrant @ homestead: ~ $ cd /var/log/nginx
vagrant @ homestead: ~ $ ls
access.log error.log {your-site-map-name}-error.log
vagrant @ homestead: ~ $ cat {your-site-map-name}-error.log
When you get this error:
connect () to unix: /var/run/php/php7.3-fpm.sock failed
then you can fix it so:
vagrant @ homestead: ~ $ php -v
or
vagrant @ homestead: ~ $ cd /var/run/php/
vagrant @ homestead: ~ $ ls
You wil get you file version, my is 8.1:
php8.1-fpm.pid php8.1-fpm.sock php-fpm.sock
Then you need to go:
vagrant @ homestead: ~ $ cd /etc/nginx/sites-enabled
vagrant @ homestead: ~ $ sudo nano {your-site-map-name}.test
Change it in this file {your-site-map-name} .test:
fastcgi_pass unix: /run/php/php8.1-fpm.sock;
Or on a different one that you got.
Then you need only restart nginx:
vagrant @ homestead: ~ $ sudo service nginx restart
and should be working.
Upvotes: 1
Reputation: 115
Can you add your homestead.yaml to your question?
I know you have said you've tried changing the PHP version. I'm unable to comment because of reputation so I'll answer with the typical fix for this issue below.
Had the same issue with the latest version of homestead.
There's an issue with xdebug that the homestead developers are waiting for a fix for. The solution is to disable xdebug or use php 7.2. I opted for the latter. In that case, make the following change in your homestead.yaml and then running vagrant reload --provision
will fix this.
sites:
- map: homestead.test
to: /home/vagrant/code/public
php: "7.2"
Upvotes: 2