Configuring Multiple Laravel Homestead Sites and Databases

  • March 23, 2016

Welcome to the incredibly popular Easy Laravel 5 companion blog. To celebrate the new edition's release (updated for Laravel 5.5!) use the discount code easteregg to receive 20% off the book or book/video package! » Buy the book

Once acquainted with Laravel's Homestead virtual machine, I quickly became so enamored that within days I was managing all of my development projects on it. In this post I'll show you how to do so.

Defining multiple projects within the Homestead.yaml file might seem difficult however I promise it is quite easy after seeing an example. Check out the following slimmed down version of my own Homestead.yaml file, which defines two projects ( and

    - map: ~/Code/
      to: /home/vagrant/
    - map: ~/Code/
      to: /home/vagrant/

    - map:
      to: /home/vagrant/
    - map:
      to: /home/vagrant/

    - dev_larabrain_com
    - dev_todoparrot_com

Notice how I've also defined two different databases, since each application will logically want its own location to store data.

After saving these changes, you'll want your virtual server to be reconfigured accordingly. If you have never started your virtual server, running vagrant up will be suffice because the Homestead.yaml file had never previously been read. However, if you've been following along then you'll need to force Homestead to re-provision the virtual machine. This involves reloading the configuration. To do so, you'll first want to find the identifier used to present the currently running machine, done using the global-status command:

$ vagrant global-status
id       name    provider   state   directory
6f13a59  default virtualbox running /Users/wjgilmore/Homestead

Copy and paste that id value (6f13a59 in my case), supplying it as an argument to the following command:

$ vagrant reload --provision 6f13a59
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...

Once this command completes running, your latest Homestead.yaml changes will be in place!