Virtual hosts configuration in vagrant homestead/laravel

Question:

I'm starting in Laravel and would like to organize my development environment using some " hosts " for my projects. I created the first project in laravel and after suffering a bit with its installation, it worked like a charm. Then I started a new project, set up homestead.yaml and my system hosts , but when I try to access it through the browser it still points to the first project. I tried to stop the artisan server but the problem continued, I searched the internet and the solutions I found didn't work. I use ubuntu 16.04 and laravel 5.2 with homestaed ( vagrant/virtualbox ). Below I transcribe part of the hosts and Homestead.ymal files so you can have an idea of ​​how they were configured. I ask friends for help in trying to solve this problem. Thanks.

[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

Answer:

Dude, you need to give the vagrant init command inside your project folder. After that, a file called vagrantfile will be generated. You need to open this file and box the homestead in it. I believe you have already done this with the first project.

Scroll to Top