Windows 上安裝 Laravel Homestead


  • 下載和安裝Git 的git bash、 virtualboxvagrant

  • 在命令行或Git Bash中使用以下命令安裝 Homestead Vagrant box

vagrant box add laravel/homestead
  • 在隨意的分盤中用Git Bash中安裝 Homestead
cd D:
git clone https://github.com/laravel/homestead.git Homestead
  • 一旦你克隆完 Homestead 的代碼倉庫,即可在 Homestead 目錄中運(yùn)行 bash init.sh命令來創(chuàng)建Homestead.yaml配置文件。該文件在C:\Users\用戶名.homestead中。
bash init.sh
  • 配置 Homestead
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:  #windows和hometead兩個系統(tǒng)共享一個文件夾,映射
    - map: D:/LaravelWorkSpaces  #這個是項目的地址,例如D:\隨便\項目的目錄 1
      to: /home/vagrant/Code #這個是homestead系統(tǒng)的地址
sites:   #sites屬性可以幫助你可以輕易指定一個 域名來對應(yīng)到 homestead 環(huán)境中的一個目錄上,可以設(shè)置多個應(yīng)用的地址
    - map: homestead.app   #這個是你項目要設(shè)定在你的瀏覽器上的地址
      to: /home/vagrant/Code/blog/public
    - map: blog.app   #這個是你項目要設(shè)定在你的瀏覽器上的地址
      to: /home/vagrant/Code/blog/public

      #- map: leimu.local
      #  to: /home/vagrant/Code/leimu/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

必須將在 Nginx sites 中所添加的「域名」也添加到你本機(jī)電腦的 hosts上。hosts文件會將請求重定向至 Homestead 環(huán)境中設(shè)置的本地域名。

192.168.10.10 homestead.app
92.168.10.10   blog.app
  • 啟動 Vagrant box
    編輯完 Homestead.yaml后,在命令行里進(jìn)入你的 Homestead 目錄并運(yùn)行 vagrant up命令
vagrant up
  • 通過 SSH 連接Homestead
$ vagrant ssh
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-38-generic x86_64)
    Documentation:  https://help.ubuntu.com
    Management:     https://landscape.canonical.com
    Support:        https://ubuntu.com/advantage
4 packages can be updated.
0 updates are security updates.
Last login: Tue Nov 22 02:10:45 2016 from 10.0.2.2

參考:Laravel Homestead

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容