Support the ongoing development of Laravel.io →
posted 9 years ago
Installation
Last updated 1 year ago.
0

I'm not 100% sure, because I'm having trouble with the authentication part of setting up my Homestead. However, it seems to me here is how these path mappings work.

folders -> map is the path on your computer's actual hard drive where you store all your Laravel projects. You can have one directory, then house each of your individual Laravel projects in subdirectory. This makes it easier to add future projects without having to add more mapped folders here; you just start something new in a subdirectory and it will automatically be on the vagrant box.

folders -> to is where the directory above will be synced inside of your virtual box. I'm not sure, but I think you need to leave the /home/vagrant part alone, but you can set /Code to whatever you want. Projects, or awesomeness, or whatever.

sites -> map is the domain name you want your site to be accessible at in your web browser (assuming you add it to your hosts file).

sites -> to: is the docroot, on the vagrant box, for this domain. Let's say in the folders part you have set up /Users/Tom/LaravelProjects to map to /home/vagrant/LaravelProjects. Inside your /LaravelProjects you start a new app in the directory /AwesomeApp1. That will be accessible inside your Homestead at /home/vagrant/LaravelProjects/AwesomeApp1. If you keep the standard directory structure of a fresh Laravel install, your public files will be inside public. So you would set the sites -> to to /home/vagrant/LaravelProjects/AwesomeApp1/public

You can set up multiple domains under sites. Just adjusting the domain and it's docroot accordingly for each entry.

Hopefully that answered your question. And if I'm wrong, someone correct me so I don't make a mess of my own use of Homestead, once I resolve my SSH issue.

Last updated 1 year ago.
0

Hi guys I had the same problem, I'm on mac though and here's how I did it.

folders:
  - map: /Users/yourname/laravelapp
    to: /home/vagrant/Code // This is within the Homestead env, if you SSH into Homestead then cd into Code you will see this.

 sites:
    - map: homestead.app
     to: /home/vagrant/Code/public //Because I haven't set any other dir up i used default Code directory this needs to point like this.

Also has mentioned above you can have as many as you like within the yml file.

Last updated 1 year ago.
0

Here is how I see the homestead setup for multiple sites.

folders:
  - map: /Users/yourname/Sites
    to: /home/vagrant/Sites

 sites:
    - map: client1.app
     to: /home/vagrant/Sites/Client1/public
   - map: client2.app
     to: /home/vagrant/Sites/Client2/public

So in this case "Sites" is kinda like the "Code". This will kind of be the root of all your sites hosted on that server.

Last updated 1 year ago.
0

Thanks @lstables and @brenelz

Between the two of you I got things going properly now

Last updated 1 year ago.
0

Apparently Homestead.yaml is a hard work, at least on Windows...

My YAML is:

---
authorize: c:/Users/Andre/.ssh/id_rsa.pub

keys:
    - c:/Users/Andre/.ssh/id_rsa

folders:
    - map: c:/Users/Andre/Code
      to: /home/vagrant/Code

sites:
    - map: xenioz.app
      to: /home/vagrant/Code/xeniozNew/public

There is a Laravel project c:/Users/Andre/Code/xeniozNew/public, there is a Laravel Project on /home/vagrant/Code/xeniozNew/public. I've tried everything, but I only get a blank page when navigating to http://xenioz.app (indeed the same for 127.0.0.1).

What I'm doing wrong?

Best rgs

Last updated 1 year ago.
0

@anotherZero

Your welcome, glad you got it working, took me a while to get my head around it.

Last updated 1 year ago.
0

yes, I tried, @mgsmus.

nothing...

Last updated 1 year ago.
0

Have you tried to put your path between double quotes?

Last updated 1 year ago.
0

Just tried, @vtalbot, nothing...

Last updated 1 year ago.
0

@sambarocker

Have you run "vagrant up" when in the homestead directory? The virtual machine isn't accessible until this is done.

Last updated 1 year ago.
0

If it helps, my working homestead.yaml looks like this:

---
authorize: /Users/me/.ssh/id_rsa.pub

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

folders:

    - map: /Users/me/Dropbox/Dev/amazingapp
      to: /home/vagrant/Code/

sites:

    - map: amazingapp.app
      to: /home/vagrant/Code/amazingapp/Laravel/public

Remember to add amazingapp.app to your hosts file as per the documentation.

My folder structure is like so

- Dev
-- amazingapp
-- homestead

Remember to cd into homestead directory and run "vagrant up".

Bear in mind I haven't got multiple setups working just yet, but will try again soon when I get time.

Last updated 1 year ago.
0

OK, unistalled Virtual Box and Vagrant, and reinstalled them (but using VB 4.3.8).

Now it's working!

Thanks everyone

Last updated 1 year ago.
0

how do i access the hosts file on xampp??

Last updated 1 year ago.
0

@ubilli The windows hosts file is at "C:\Windows\System32\drivers\etc" - open it as Admin

For Mac/Linux "/etc/hosts" - open it as root

Last updated 1 year ago.
0

Once you have your sites set up like brenelz has them in his post above, simply run the following command inside your VM

server appnam.app /home/vagrant/Code/Laravel/public

or whatever the path to your application is

Last updated 1 year ago.
0

I have the same problem, i just can't get files to sync to vagrant box. I tried what @fallendown has suggested, running: server laravel.app /home/vagrant/Code/proj-name/public Don't know what should that do but it doesn't help.

0

Hello every body, I finished intalling Homestead Last month and now I figured out all the ins and outs in it. I learned it the hard way. Laravel IRC + Stack overflow helped a lot. Here is the article https://abbasharoon.me/homestead-yaml-explained-a-z/ about Homestead.YAML, as the thread is relevant and I learned it the hard way, so I thought I might help others.

Cheers :)

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tomhoad tomhoad Joined 19 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.