Virtual hosts configuration in Vagrant Homestead/Laravel

Asked

Viewed 592 times

4

I’m starting to Laravel and would like to organize my development environment using some "hosts" for my projects. I created the first Larable and after suffering a little with its installation, it worked out that it was a beauty. Then I started a new project, I set up the Homestead.yaml and the hosts from my system, but when I try to access through the browser it still points to the first project. I tried to stop the Artisan but continued with the problem, researched on the internet and the solutions I found did not work . I use the Ubuntu 16.04 and the Laravel 5.2 with the homestaed (Vagrant/virtualbox). Below transcribe part of the files hosts and Homestead.ymal so you can get an idea of how they were set up. I ask friends for help in trying to solve this problem. Thank you.

[hosts]
# vagrant hosts
192.168.10.10 homestead.app
192.168.10.10 api.app
[homestead.yaml]
ip: "192.168.10.10"
folders:
- map: /home/<user>/Dropbox/Projetos/Laravel-PHP/Projetos
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: api.app
to: /home/vagrant/Code/ApiTeste/public
  • See the orientation of the Laravel website: http://laravel.artesa.org/docs/5.1/homestead#Adding-Additional-sites

2 answers

0

You have to do Provision box, if the box is already started, you must use the command vagrant reload --provision from the command line on the host, it will read Homestead.yaml again and configure Nginx correctly.

Restart nay is sufficient as the box is already provisioned and this step is ignored during startup.

If the machine is stopped you can also use the flag provision at startup for new settings to be read vagrant up --provision.

This problem is probably already solved, but here is the answer if someone has a similar problem in the future.

Curious that this question with almost 2 years, came the first page when I’m trying to set up a box using laravel/homestead to race Magento2.

  • Have you tried vagrant reload?

0

Man, you need to give command vagrant init inside your project folder. Done this a file called vagrantfile will be generated. You need to open this file and set the Homestead box in it. I believe you have done this with the first project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.