日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Homestead 使用总结

發(fā)布時間:2024/9/20 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Homestead 使用总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

來源:http://www.cnblogs.com/xghb/p/4904146.html

homestead

Laravel Homestead是一個官方預封裝的Vagrant“箱子”

內置 Nginx、PHP 5.6、MySQL、Postgres、Redis、Memcached 等常用軟件

安裝

安裝VirtualBox 和 Vagrant

添加?laravel/homestead?盒子

vagrant box add laravel/homestead

克隆 homestead 配置

git 克隆

git clone https://github.com/laravel/homestead.git Homestead

composer 安裝方式

composer global require "laravel/homestead=~2.0"

~/.composer/vendor/bin?目錄添加到 PATH 環(huán)境變量中后,可執(zhí)行homestead

編輯Homestead.yaml配置文件

生成 Homestead.yaml 配置文件

homestead方式?homestead init

shell方式?bash init.sh

編輯 Homestead.yaml

homestead方式?homestead edit

直接編輯?vim ~/.homestead/Homestead.yaml

配置與操作

配置詳解

ip: "192.168.10.10" memory: 512 cpus: 1 provider: virtualbox # 需要使用的 Vagrant prodiver:virtualbox還是vmware_fusionauthorize: ~/.ssh/id_rsa.pub # 公鑰路徑keys: - ~/.ssh/id_rsa # 秘鑰路徑folders: # 共享目錄 - map: ~/Code to: /home/vagrant/Codesites: # 配置站點 - map: homestead.app to: /home/vagrant/Code/Laravel/publicdatabases: - homesteadvariables: - key: 'APP_ENV' value: 'local' - key: 'APP_DEBUG' value: 'true'# blackfire: # Blackfire Profiler分析工具 # - id: foo # token: bar # client-id: foo # client-token: bar# ports: # 自定義端口轉發(fā) # - send: 93000 # to: 9300 # - send: 7777 # to: 777 # protocol: udp

虛擬機操作

Homestead?目錄下

  • 開機: vagrant up
  • 關機: vagrant halt
  • 銷毀: vagrant destroy --force
  • 登錄: vagrant ssh
  • 訪問網站

  • 綁定hosts?192.168.10.10 homestead.app
  • 訪問?http://homestead.app
  • 登錄

    SSH登錄

  • 通過ssh登錄?ssh vagrant@127.0.0.1 -p 2222
  • 或者創(chuàng)建別名?alias vm="ssh vagrant@127.0.0.1 -p 2222",使用vm登錄

  • 通過在Homestead 目錄使用 vagrant ssh 命令
  • 連接虛擬機內Mysql

    mysql -h 127.0.0.1:33060 -u homestead -p secret

    端口映射

    • SSH: 2222 → Forwards To 22
    • HTTP: 8000 → Forwards To 80
    • HTTPS: 44300 → Forwards To 443
    • MySQL: 33060 → Forwards To 3306
    • Postgres: 54320 → Forwards To 5432

    增加額外端口

    ports: - send: 93000 to: 9300 - send: 7777 to: 777 protocol: udp

    增加站點

    方式一

  • Homestead.yaml 文件中增加站點
  • Homestead 目錄中執(zhí)行 vagrant provision
  • 會破壞以后數據庫

    方式二 Homestead環(huán)境中的?serve?命令

  • SSH 進入 Homestead 環(huán)境中
  • 執(zhí)行下列命令serve domain.app /home/vagrant/Code/path/to/public/directory 80
  • 參考資料

    • Laravel Homestead
    • blackfire
    • NFS


    總結

    以上是生活随笔為你收集整理的Homestead 使用总结的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。