laravel Configuring Homestead

Setting Your Provider
The provider key in your Homestead.yaml file indicates which Vagrant provider should be used: virtualbox, vmware_fusion, vmware_workstation, parallels or hyperv. You may set this to the provider you prefer:

The folders property of the Homestead.yaml file lists all of the folders you wish to share with your Homestead environment. As files within these folders are changed, they will be kept in sync between your local machine and the Homestead environment. You may configure as many shared folders as necessary:
vagrantの設定です。

folders:
– map: ~/code/project1
to: /home/vagrant/code/project1

– map: ~/code/project2
to: /home/vagrant/code/project2

You may also pass any options supported by Vagrant’s Synced Folders by listing them under the options key:

folders:
– map: ~/code
to: /home/vagrant/code
type: “rsync”
options:
rsync__args: [“–verbose”, “–archive”, “–delete”, “-zz”]
rsync__exclude: [“node_modules”]
このへんもそうですね。

Configuring Nginx Sites
Not familiar with Nginx? No problem. The sites property allows you to easily map a “domain” to a folder on your Homestead environment. A sample site configuration is included in the Homestead.yaml file. Again, you may add as many sites to your Homestead environment as necessary. Homestead can serve as a convenient, virtualized environment for every Laravel project you are working on:

If you change the sites property after provisioning the Homestead box, you should re-run vagrant reload –provision to update the Nginx configuration on the virtual machine.

The Hosts File
You must add the “domains” for your Nginx sites to the hosts file on your machine. The hosts file will redirect requests for your Homestead sites into your Homestead machine. On Mac and Linux, this file is located at /etc/hosts. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts. The lines you add to this file will look like the following:

192.168.10.10 homestead.test

etc/hosts の中身

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

なんじゃこりゃ。

Make sure the IP address listed is the one set in your Homestead.yaml file. Once you have added the domain to your hosts file and launched the Vagrant box you will be able to access the site via your web browser:

http://homestead.test

Launching The Vagrant Box
Once you have edited the Homestead.yaml to your liking, run the vagrant up command from your Homestead directory. Vagrant will boot the virtual machine and automatically configure your shared folders and Nginx sites.

To destroy the machine, you may use the vagrant destroy –force command.
あれ、homestead.yamlでvagrant upだっけ?boxファイルでなかった!?