How to add a new project in Laravel Homestead

If you want to add a new project in Laravel Homestead, you have to edit the “Homestead.yaml” file, adding a new site:

sites:
....
- map: mynewsite.app
 to: /home/vagrant/Code/mynewsite/public
....
databases:
 - mynewdatabase

Then you have to provision the VM another time, running

$ vagrant reload --provision

If you access to the VM, running

$ vagrant ssh

You can see the new nginx configuration file in the /etc/nginx/sites-enabled/ folder

$ ls /etc/nginx/sites-enabled/ -la

mynewsite.app -> /etc/nginx/sites-available/mynewsite.app

You have to edit the hosts file with the Vagrant VM IP and the new domain

192.168.10.10 mynewsite.app

Now you can access to the new site in your web browser with the URL:

http://mynewsite.app

References:

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.