Someone please help =s can't find a solution to this.
502 Bad Gateway: nginx 1.9.7, Homestead
I am getting a 502 bad gateway when I try to go to my project.dev site.
When I run "vagrant up", I get this error at the end:
==> default: php5-fpm: unrecognized service
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
I was looking at this topic to try and find a solution: https://laracasts.com/discuss/channels/general-discussion/502-bad-gateway-nginx-197-in-homestead-laravel-5 -- and it kind of works.. but there are a couple of problems.
- In my "/etc/nginx/sites-enabled", there is only a "laravel.app", though my homestead.yaml looks like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Homestead/Projects
to: /home/vagrant/Sites
sites:
- map: laravel.app
to: /home/vagrant/Sites/dream/public
- map: blog.app
to: /home/vagrant/Sites/blog/public
- map: project.dev
to: /home/vagrant/Sites/project-v1/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
... so it should contain a laravel.app, blog.app and project.dev, right..?
I followed these steps first to fix the 502 gateway error:
- First, typed this:
sudo nano /etc/nginx/sites-enabled/laravel.app
- Then edited the fastcgi_pass line to this:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
- Then restart nginx and php7.0-fpm:
sudo service nginx restart
sudo service php7.0-fpm reload
I do that and go to project.dev, as shown as one of the sites in my homestead.yaml, and it removes the 502 bad gateway error at least, but it goes to the laravel.app site instead of the project.dev site.
My hosts file contains all three files and so does the homestead.yaml as shown above, and when I exit the ssh and try running vagrant provision or just try to vagrant up again, it resets the step #2 line back to what it was before, which was giving the error of php5-fpm: unrecognized service.
Anyone know what I am doing wrong or how to solve this?
- Why do the three steps not stay saved?
- Why is only laravel.app showing in "/etc/nginx/sites-enabled", though I have three sites in hosts and homestead.yaml?
I had this exact same error & I had an old version of Homestead which was being picked up somewhere along the way.
I ended up removing all versions/copies of Homestead, including my composer global homestead copy. Once this was done, added Homestead back in and worked 1st time.
Please or to participate in this conversation.