分享我这两天遇到的问题,希望对大家有启发,另外我们可以热心的帮助别人,感谢 @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 虚拟机的状态。
推荐文章: