[英]Laravel 5 Vagrant box laravel/homestead give 502 bad gateway
Its been 3 days now, still I am unable to solve this.现在已经3天了,我仍然无法解决这个问题。 I have just installed the vagrant box on my Yosemite.
我刚刚在优胜美地安装了 vagrant box。 I am learning to work with vm.
我正在学习使用 vm。 Following the steps over Laravel Homestead I had installed vagrant box of homestead.
按照Laravel Homestead的步骤,我安装了 vagrant box of homestead。 But its giveing me 502 Bad gateway.
但它给了我 502 Bad gateway。 I had set up laravel.local in host file also.
我也在主机文件中设置了 laravel.local 。
I tried other links for ngnix (1.8.0) but, I am unable to run laravel on homestead vm!!?我尝试了 ngnix (1.8.0) 的其他链接,但是,我无法在 homestead vm 上运行 laravel!?
This is the output of /var/log/nginx/laravel.local-error.log这是 /var/log/nginx/laravel.local-error.log 的输出
2015/07/12 18:54:31 [error] 957#0: *20 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.10.1, server: la5.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "la5.dev"
2015/07/12 19:03:07 [error] 1957#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.10.1, server: la5.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "la5.dev"
2015/07/12 19:04:33 [error] 2006#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.10.1, server: la5.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "la5.dev"
vagrant@homestead:/var/log/nginx$ vagrant@homestead:/var/log/nginx$
And this is my Homestead.yaml这是我的 Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/maahedev/code/la5
to: /home/vagrant/la5
sites:
- map: la5.dev
to: /home/vagrant/la5/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
Any help/suggestion is highly appreciated.任何帮助/建议都受到高度赞赏。
EDIT: output of netstat -antp
编辑:
netstat -antp
输出
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2477/nginx: worker
tcp 0 0 0.0.0.0:57219 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:11300 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2477/nginx: worker
tcp 0 0 10.0.2.15:22 10.0.2.2:50267 ESTABLISHED -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::5432 :::* LISTEN -
tcp6 0 0 :::47876 :::* LISTEN -
tcp6 0 0 :::6379 :::* LISTEN -
tcp6 0 0 :::111 :::* LISTEN -
That worked for me:这对我有用:
from your virtual machine bash, go to the paste /etc/nginx/sites-enabled/从您的虚拟机 bash,转到粘贴 /etc/nginx/sites-enabled/
there, run ls -la
在那里,运行
ls -la
you will see your projects there你会在那里看到你的项目
run sudo nano "your project name"
运行
sudo nano "your project name"
look for the line: fastcgi-pass ... php/php7.number...
寻找这一行:
fastcgi-pass ... php/php7.number...
update the "number" variable with 2, so you get: fastcgi-pass ... php/php7.2...
用 2 更新“number”变量,所以你得到:
fastcgi-pass ... php/php7.2...
restart nginx and php services with: sudo service nginx restart && sudo service php7.*-fpm restart
使用以下
sudo service nginx restart && sudo service php7.*-fpm restart
重新启动 nginx 和 php 服务: sudo service nginx restart && sudo service php7.*-fpm restart
than try to run your site again比尝试再次运行您的网站
First fix any permissions problems on your storage folders首先修复您的存储文件夹上的任何权限问题
sudo chmod -R 777 /root/to/yourapp/storage/
Also make sure you don't have any other VM environments running at the same time and shut them down using vagrant halt.This error is most likely because you have a port conflict on your system.还要确保您没有同时运行任何其他 VM 环境,并使用 vagrant halt 关闭它们。此错误很可能是因为您的系统上存在端口冲突。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.