现在已经3天了,我仍然无法解决这个问题。我刚在Yosemite上安装了流浪盒。我正在学习使用vm。按照Laravel Homestead的步骤,我安装了流浪汉的宅基地。但它给了我502 Bad gateway。我也在主机文件中设置了laravel.local。
我尝试了ngnix(1.8.0)的其他链接但是,我无法在homestead vm上运行laravel !!
这是/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 $
这是我的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
非常感谢任何帮助/建议。
编辑: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 -
答案 0 :(得分:0)
对我有用:
在虚拟机bash中,转到/ etc / nginx / sites-enabled /
在那里运行ls -la
您将在那里看到您的项目
运行sudo nano "your project name"
查找以下行:fastcgi-pass ... php/php7.number...
将“ number”变量更新为2,因此您得到:fastcgi-pass ... php/php7.2...
使用sudo service nginx restart && sudo service php7.*-fpm restart
比尝试再次运行您的网站
答案 1 :(得分:-1)
首先修复存储文件夹上的任何权限问题
sudo chmod -R 777 /root/to/yourapp/storage/
还要确保没有任何其他VM环境同时运行,并使用vagrant halt将其关闭。此错误很可能是因为您的系统上存在端口冲突。