国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
約定" >約定
安裝 virtualbox 和 vagrant" >安裝 virtualbox 和 vagrant
下載并配置 Homestead" >下載并配置 Homestead
克隆 homestead 項目" >克隆 homestead 項目
加入 homestead box
修改 homestead 的配置
配置 hosts 文件
" >配置 hosts 文件
初始化 homestead 虛擬機" >初始化 homestead 虛擬機
Home PHP Framework Laravel Laravel local environment construction: Deployment of Homestead development environment

Laravel local environment construction: Deployment of Homestead development environment

Jul 31, 2018 pm 02:55 PM

Laravel框架在php開發(fā)過程是不斷進行優(yōu)化的,當然也包括了本地環(huán)境的開發(fā),下面我們就來具體看看laravel框架中的Homestead 開發(fā)環(huán)境的部署內(nèi)容。

首先白以下幾個概念

  • VirtualBox?-- Oracle 公司的虛擬機軟件, 能運行在當前大部分流行的系統(tǒng)上;

  • Vagrant?提供一種命令行接口, 允許自動化安裝虛擬機, 并且因為是腳本編寫成的?provision?文本文件, 給共享虛擬機配置提供了可能, Homestead 正是構(gòu)建在 Vagrant 之上;

  • Laravel Homestead?是官方預封裝的一個 Vagrant Box,它是一臺虛擬機的原型, 用來快速生產(chǎn)一個配置完整的服務器虛擬機, 運行在 VirtualBox 上.

Homestead 生產(chǎn)出來的虛擬機提供了一個完整的開發(fā)環(huán)境, 有了這個環(huán)境, 就不用再擔心各種軟件的設(shè)置會搞亂你的操作系統(tǒng)啦.

因為是虛擬機, 出現(xiàn)故障的時候, 可以在幾分種內(nèi)完成銷毀和重建.

Homestead 能運行在所有的Windows、Mac和Linux上,它包含了Nginx、PHP 5.5、MySQL、Postgres、Redis、Memcached和你開發(fā) Laravel應用程序需要的所有其它軟件。

在多人協(xié)同開的情況下, Homestead 能用來統(tǒng)一開發(fā)環(huán)境, 讓程序員把精力更集中的放在程序業(yè)務邏輯上, 免去了各種因為開發(fā)環(huán)境不一樣而造成的混亂.

約定

假設(shè)我們要開發(fā)一個項目, 項目的名字叫?mytwitter.

首先在我們存放代碼的地方?code?文件夾里面創(chuàng)建項目根文件夾?mytwitter_project, 接下來咱們的操作都在此項目下進行

cd ~/codemkdir mytwitter_project
cd mytwitter_project

安裝 virtualbox 和 vagrant

在這里下載并安裝 VirtualBox , Vagrant .

直接下載 GUI 安裝包安裝就行.

下載并配置 Homestead

Homestead 包括以下兩個東西

  1. 一個 vagrant box 虛擬機, 里面軟件什么都下載好了;

  2. Github 代碼庫, 里面裝載著 vagrant 的配置腳本, 用來自動化配置網(wǎng)絡(luò), 端口映射, 等一些開發(fā)時候用到的配置

克隆 homestead 項目

在文件夾下克隆 homestead 項目到本地

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

加入 homestead box

執(zhí)行以下命令添加 box

vagrant box add laravel/homestead

在線下載會很慢一般用迅

可以下載最新的box文件

https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.5.0  //新版本地址

下載后執(zhí)行以下命令, 修改 /path/to/virtualbox.box 為正確的 path.

vagrant box add laravel/homestead /path/to/virtualbox.box

windows中執(zhí)行如下命令

vagrant box add laravel/homestead file:///D:/download/virtubox.box

修改 homestead 的配置

根據(jù)你的情況修改 Homestead 項目里面文件 Homestead.yaml , 類似以下

---ip: "192.168.10.10"memory: 2048cpus: 1authorize: /Users/me/.ssh/id_rsa.pub

keys:    - /Users/me/.ssh/id_rsa

folders:    - map: /Users/me/code/mytwitter_project/mytwitter
      to: /home/vagrant/mytwitter

sites:    - map: mytwitter.app
      to: /home/vagrant/mytwitter/public

variables:    - key: APP_ENV
      value: local

配置 hosts 文件

修改本機的 hosts 文件, 允許通過自定義域名訪問, 這個域名是在上面的 Homestead.yaml 里面設(shè)置的.

sudo vi /etc/hosts

添加以下一行

127.0.0.1    mytwitter.app

初始化 homestead 虛擬機

cd Homestead
vagrant up 
注意:要刪除homestead目錄下的 Vagrantfile 文件重新生成使用命令:vagrant init生成。
然后在啟動
vagrant u

生成啟動后看提示信息。

最后測試是否能成功連接, 虛擬機里的 ~/mytwitter 文件夾里的文件和本地的文件是一致的.

vagrant ssh cd ~/mytwitter
ll

瀏覽器訪問?http://mytwitter.app:8000/?.

至此, 成功安裝.

以上就是本篇文章的全部內(nèi)容了,更多請關(guān)注laravel框架入門教程。

相關(guān)文章推薦:

基于laravel5.2進行中間件源碼的解析

laravel5.4中自定義包開發(fā)的實例

相關(guān)課程推薦:

laravel基礎(chǔ)開發(fā)寶典視頻教程

2017年最新的五個Laravel視頻教程推薦

The above is the detailed content of Laravel local environment construction: Deployment of Homestead development environment. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are policies in Laravel, and how are they used? What are policies in Laravel, and how are they used? Jun 21, 2025 am 12:21 AM

InLaravel,policiesorganizeauthorizationlogicformodelactions.1.Policiesareclasseswithmethodslikeview,create,update,anddeletethatreturntrueorfalsebasedonuserpermissions.2.Toregisterapolicy,mapthemodeltoitspolicyinthe$policiesarrayofAuthServiceProvider.

How do I install Laravel on my operating system (Windows, macOS, Linux)? How do I install Laravel on my operating system (Windows, macOS, Linux)? Jun 19, 2025 am 12:31 AM

Yes,youcaninstallLaravelonanyoperatingsystembyfollowingthesesteps:1.InstallPHPandrequiredextensionslikembstring,openssl,andxmlusingtoolslikeXAMPPonWindows,HomebrewonmacOS,oraptonLinux;2.InstallComposer,usinganinstalleronWindowsorterminalcommandsonmac

What are controllers in Laravel, and what is their purpose? What are controllers in Laravel, and what is their purpose? Jun 20, 2025 am 12:31 AM

The main role of the controller in Laravel is to process HTTP requests and return responses to keep the code neat and maintainable. By concentrating the relevant request logic into a class, the controller makes the routing file simpler, such as putting user profile display, editing and deletion operations in different methods of UserController. The creation of a controller can be implemented through the Artisan command phpartisanmake:controllerUserController, while the resource controller is generated using the --resource option, covering methods for standard CRUD operations. Then you need to bind the controller in the route, such as Route::get('/user/{id

How do I customize the authentication views and logic in Laravel? How do I customize the authentication views and logic in Laravel? Jun 22, 2025 am 01:01 AM

Laravel allows custom authentication views and logic by overriding the default stub and controller. 1. To customize the authentication view, use the command phpartisanvendor:publish-tag=laravel-auth to copy the default Blade template to the resources/views/auth directory and modify it, such as adding the "Terms of Service" check box. 2. To modify the authentication logic, you need to adjust the methods in RegisterController, LoginController and ResetPasswordController, such as updating the validator() method to verify the added field, or rewriting r

How do I use Laravel's validation system to validate form data? How do I use Laravel's validation system to validate form data? Jun 22, 2025 pm 04:09 PM

Laravelprovidesrobusttoolsforvalidatingformdata.1.Basicvalidationcanbedoneusingthevalidate()methodincontrollers,ensuringfieldsmeetcriterialikerequired,maxlength,oruniquevalues.2.Forcomplexscenarios,formrequestsencapsulatevalidationlogicintodedicatedc

Selecting Specific Columns | Performance Optimization Selecting Specific Columns | Performance Optimization Jun 27, 2025 pm 05:46 PM

Selectingonlyneededcolumnsimprovesperformancebyreducingresourceusage.1.Fetchingallcolumnsincreasesmemory,network,andprocessingoverhead.2.Unnecessarydataretrievalpreventseffectiveindexuse,raisesdiskI/O,andslowsqueryexecution.3.Tooptimize,identifyrequi

How do I escape HTML output in a Blade template using {{{ ... }}}? (Note: rarely used, prefer {{ ... }}) How do I escape HTML output in a Blade template using {{{ ... }}}? (Note: rarely used, prefer {{ ... }}) Jun 23, 2025 pm 07:29 PM

InLaravelBladetemplates,use{{{...}}}todisplayrawHTML.Bladeescapescontentwithin{{...}}usinghtmlspecialchars()topreventXSSattacks.However,triplebracesbypassescaping,renderingHTMLas-is.Thisshouldbeusedsparinglyandonlywithfullytrusteddata.Acceptablecases

How do I mock dependencies in Laravel tests? How do I mock dependencies in Laravel tests? Jun 22, 2025 am 12:42 AM

TomockdependencieseffectivelyinLaravel,usedependencyinjectionforservices,shouldReceive()forfacades,andMockeryforcomplexcases.1.Forinjectedservices,use$this->instance()toreplacetherealclasswithamock.2.ForfacadeslikeMailorCache,useshouldReceive()tod

See all articles