3
votes

How can i add a new site without running ?

homestead destroy
homestead up

Im using Laravel Homestead version 2.0.13

When i add a new site, i add the following to my homestead.yaml file

folders:
   - map: ~/web/code
     to: /code/websites

sites:
  - map: laravel5.dev
    to: /code/websites/laravel5/public
  - map: anothersite.dev
    to: /code/websites/anotherproject/public

I've added to my hosts file :

192.168.10.10 laravel5.dev
192.168.10.10 anothersite.dev

I then proceed to check the status of my machine using:

vagrant global-status



90be623  default virtualbox running /Users/user/.composer/vendor/laravel/homestead

I run vagrant provision 90be623 to provision my new site but sadly anothersite.dev still points to laravel5.dev

The only way i solve this is running homestead destroy and then homestead up. But this destroys my database.

When i run vagrant provision 90be623 i notice alot of times the appearance of:

==> default: stdin: is not a tty (In red)

Versus when i do homestead destroy and homestead up where everything is in green..

Thank you for reading this and helping :)

2

2 Answers

6
votes

Ok, so i've found that if i want to add a new site, all i got to do is

  1. homestead halt
  2. homestead edit

Homestead edit will open the homestead.yaml file Here i add the mapping for the site

  1. Edit the hosts file /etc/hosts and add url i want for example app.dev and save
  2. homestead up --provision

It worked like a charm without me having to destroy my machine or databases.

3
votes

In Laravel 5.2, there is no need of halting and then starting.
After adding the new site inside the ".yaml" and "hosts" files, you only need to perform one command in the terminal, from within the Homestead directory:

vagrant reload --provision

See here: https://laravel.com/docs/5.2/homestead#adding-additional-sites