现在已经3天了,我还是无法解决这个问题。我刚刚在我的Yosemite上安装了vagrant box。我正在学习使用vm。按照步骤 Laravel Homestead 我已经安装了家园的vagrant box。但它给我502 Bad gateway. 我也在host文件中设置了laravel.local.
我试过其他的ngnix(1.8.0)的链接,但是,我无法在家园的vm上运行laravel!!?
这是varlognginxlaravel.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:varlognginx$。
这就是我的家园。
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
任何帮助suggestion都非常感谢。
编辑:输出的 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 -
这对我来说是有效的。
从你的虚拟机bash中,进入粘贴等nginxsites-enabled的状态。
那里 ls -la
你会在那里看到你的项目
运行 sudo nano "your project name"
寻找这一行。fastcgi-pass ... php/php7.number...
用2更新 "数字 "变量,所以你得到: fastcgi-pass ... php/php7.2...
重启nginx和php服务。sudo service nginx restart && sudo service php7.*-fpm restart
然后再试着运行你的网站
首先修复存储文件夹上的任何权限问题。
sudo chmod -R 777 /root/to/yourapp/storage/
同时确保您没有任何其他虚拟机环境同时运行,并使用vagrant halt关闭它们.这个错误很可能是因为您的系统上有端口冲突。