/ homestead

homestead

设置代码位置

folders:
    - map: ~/code
      to: /home/vagrant/code

站点配置

sites:
    - map: homestead.test
      to: /home/vagrant/Code/Laravel/public
      php: "5.6"
    - map: blog.app
      to: /home/vagrant/Code/blog.laravel/public
      php: '7.0'
    - map: forum.app
      to: /home/vagrant/Code/forum.laravel/public

数据库配置

databases:
    - homestead
    - blog
    - forum
mysql -uhomestead -psecret

新建数据库:

mysql -uhomestead -psecret -e "CREATE DATABASE blog CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

vagrant 命令

命令行 说明
vagrant init 初始化 vagrant
vagrant up 启动 vagrant
vagrant halt 关闭 vagrant
vagrant ssh 通过 SSH 登录 vagrant(需要先启动 vagrant)
vagrant provision 重新应用更改 vagrant 配置
vagrant destroy 删除 vagrant

当增加站点、数据库时,需要在修改 Homestead.yml 后执行 vagrant provision 来让配置生效。