分享我这两天遇到的问题,希望对大家有启发,另外我们可以热心的帮助别人,感谢 @leo
问题:1
homestead-7: Running: script: Restarting Nginx
==> homestead-7: Failed to restart php7.1-fpm.service: Unit php7.1-fpm.service not found.
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.
这个时候是你的box的版本中不包含php7,但是你的homestead却使用了php7模块。
解决办法:降低homestead版本或者升级box版本到大于6.0
参考:https://learnku.com/docs/laravel/5.3/homestead#lau...
我自己的配置如下(注意前两行box和version 找个地方是可以指定的。。。):
---
box: laravel/homestead
version: 0.5.0
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: test.zxy.com
to: /home/vagrant/Code/mywork/blog/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
问题2:
按照这个教程https://learnku.com/docs/laravel/5.3/homestead#launching-the-vagrant-box配置之后
配置host的时候一定要配置homestead.yaml中的IP到物理机器的hosts中
问题3:
homestead.yaml 的配置未生效呢?
参见https://learnku.com/laravel/t/3474#reply17768 这个问题是我提的,困扰了我 2天,在这里感谢 @leo,论坛中仅仅一个人回复了我。
问题产生的原因:应该是我开始启动homestead虚拟机的时候误操作,造成了另外一个问题,导致homestead文件夹下面的Vagrantfile丢失,然后呢
我自己用Vagrant init命令重新生产了一个。。。晕,这让我陷入了歧途。。。
解决:重新下载homestead,直接运行 homestead up命令,就可以了
下面是常用的 Homestead 命令:
homestead up:该命令用于启动 Homestead 虚拟机,如果加上 --provision 选项那么添加的新站点会发布到虚拟机上。
homestead halt:关闭 Homestead 虚拟机。
homestead suspend:暂停 Homestead 虚拟机。
homestead resume:恢复暂停的 Homestead 虚拟机。
homestead edit:编辑 Homestead.yaml 文件,这会使用系统中与 .yaml 文件关联的任意编辑器。
homestead status:查看当前 Homestead 虚拟机的状态。
推荐文章: