Laravel Homestead vhost configuration Laravel Homestead vhost configuration nginx nginx

Laravel Homestead vhost configuration


You add a new folder mapping into the "sites" block of Homestead.yml, like so:

- map: myapp.com  to: /home/vagrant/Code/myapp/public

That's all there is to adding a new vhost. To modify it, edit the appropriate file in /etc/nginx/sites-available. In the above case, this would be /etc/nginx/sites-available/myapp.com

See here for example customization of a newly added vhost. Note that the quick tip linked here uses Homestead Improved, a slightly enhanced version of Homestead, as described here.

More Homestead related posts can be found on our site via the Homestead tag.


I have been looking for a solution for customizing nginx vhosts. You want to do it in provisioning, or better: after provisioning otherwise Homestead will overwrite any changes you have done manually to the vhost files.

One solution is the one I found here:https://laracasts.com/discuss/channels/requests/homestead-provision-deletes-custom-nginx-settings

Basically you create configuration files in a folder in the host machine, map that extra folder to the vagrant machine, then in your after.sh file (which is run by homestead after the normal provisioning is finished) you just copy all of them to nginx's sites_available folder.