咱们先看一下初始的Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/project1/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
重点说一下folders和sites
多站点配置,按照以下方式配置,将项目名换一下就行,记得要修改hosts文件
folders:
- map: D:/code/project1_name
to: /home/vagrant/code/project1_name
- map: D:/code/project2_name
to: /home/vagrant/code/project2_name
sites:
- map: homestead1.test
to: /home/vagrant/code/project1_name/public
- map: homestead2.test
to: /home/vagrant/code/project2_name/public
有人就又要问了,为什么sites要映射到public,因为public是项目的入口,具体请看文档的核心架构部分
hosts文件用还是比较多的,所以说在桌面设置一个快捷方式,就不用每次去打开目录再找了
经过某同学提醒,在这里多加一行
在gitbash或者其他工具中运行下面命令(必须在Homestead目录下)
vagrant reload --provision