Adding a new site to Laravel Homestead
If it has been a while since you set up the Laravel Homestead Vagrant you may have forgotten how to add new sites. Or maybe you have added new sites but they are not working. Below are the steps that always work for me on the Mac.
Open terminal then the Homestead.yaml file with your editor of choice.
sudo vim ~/.homestead/Homestead.yaml
Add the folders to map. If using vim as the editor you must press “i” to insert text
folders:
- map: "/Applications/MAMP/htdocs/vagrant/temprano/cohea-app/webservice"
to: "/home/vagrant/cohea-webservice
Add the sites to map the domain name to the site. If using vim press “Escape” then “:wq” “enter” to save
sites:
- map: "api.webservice.cohea.app"
to: "/home/vagrant/cohea-webservice/public"
Now it is time to edit the hosts file and add the domain.
sudo vim /etc/hosts
Now add the Domain to your host file and save.
192.168.10.10 api.webservice.cohea.app
Go to the directory containing your Homestead Vagrant installation and run the below command
MacBook-Pro:Homestead7 user$ vagrant up
MacBook-Pro:Homestead7 user$ vagrant provision
MacBook-Pro:Homestead7 user$ vagrant reload
Thats it. The domain should now work.
Recent Comments