Reputation: 1724
I am new to laravel And I am still confused the configuration of Homestead.yaml
my laravel project resides in C:/wamp/www/laravel and in Homestead.yaml I configured it like below
folders:
- map: /wamp/www/laravel
to: /home/Vagrant/Code
sites:
- map: homestead.app
to: /home/Vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
What is wrong with this configuration?Also do I have to manually create
/home/Vagrant/Code
and
/home/Vagrant/Code/Laravel/public?
if yes,in which windows directory?I am confuse about the /home directories since i am using a windows 8 machine.
Upvotes: 3
Views: 2935
Reputation: 2609
Ah yes, homestead configuration have also puzzled me a lot. I can recommend you buy the ebook Easy Laravel 5 by Jason Gilmore, or read the homestead chapter for free online right here. It was his chapter on homestead configuration that helped me understand how to do it. The ebook also contains lots of other good stuff on Laravel 5 development, and is often updated.
Update: The Laravel 5 Beauty blog also has a very easy to understand guide on how to set up homestead for Laravel 5.1. both on Windows, Linux and Mac.
That said, I'll try to answer your question right here. Step 5 is how to set up the homestead configuration. And no, you do not have to creat the vagrant/Code folder yourself. It's an alias for the path you provide.
0. Install Composer if you haven't already.
Also add the composer bin to your path:
LINK TO BIGGER VERSION OF PICTURE BELOW
1. Make sure you have downloaded the latest version of Vagrant and Oracle VirtualBox
2. Add the laravel box: $ vagrant box add laravel/homestead
3. Install the Homestead CLI tools: $ composer global require "laravel/homestead=~2.0"
4. Create your .homestead folder:
$ cd
-> Goes to your user folder
$ homestead init
-> Creates the .homestead folder
Also note here that you need to have the .ssh folder including the id_rsa and id_rsa.pub file. If you don't have it in your user folder, follow this guide to get it..
5. Edit your Homestead.yaml file. I'll use my setup as an example here:
LINK TO BIGGER VERSION OF PICTURE BELOW
6. Go to C:\Windows\System32\drivers\etc\
and edit the hosts file. It will warn you and demand administrator rights. Just open it with admin control.
Edit your hosts file with the urls you set up in your homestead.yaml file:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.10.10 phpmyadmin.local
192.168.10.10 lara.local
192.168.10.10 todoparrot.local
7. Run the following CLI commands to provision vagrant. To be honest, I'm not too sure what this does, but it kinds of restart vagrant so it'up to date with your homestead.yaml and hosts configurations.
$ vagrant global-status
-> Note the little number that comes up at the start. Mine is 2a6e97d
$ vagrant provision 2a6e97d
8. Run $ homestead up
, let it finish running and go to your url, in my case lara.local. Here is my screen:
I hope this wasn't too confusing. Setting up homestead is a real pain the first time, but when you "get" how it works, it becomes pure bliss to develop with.
If anything is unclear, please write a comment and I'll try to help :)
Upvotes: 10