How to provision nginx vhosts on Vagrant vm?

by Jake Wilson   Last Updated April 15, 2019 11:00 AM

I have a Ubuntu VM machine I'm running through Vagrant with nginx installed. It's pretty easy to ssh into the VM and setup a new nginx vhost whenever I need one. But what is the best practice for setting up nginx vhosts via Vagrant provisioning, or maybe using Puppet? Essentially I imagine some sort of config file(s) that sit in my host folder and when I provision, it parses these config files and creates a new vhost for me on the VM.

Tags : vagrant

Answers 2

Have a look at particularly

With this you will be able to set anything you need on the vagrant VM.

July 26, 2016 15:10 PM

There is a vagrant plugin - hostupdater. It can automatically update /etc/hosts and add virtual hosts pointing to your guest machine

Vagrant file configuration example: :private_network, ip: ""
config.vm.hostname = ""
config.hostsupdater.aliases = ["", ""]
January 18, 2017 09:59 AM

Related Questions

Updated October 23, 2015 06:00 AM

Updated June 02, 2017 16:00 PM

Updated September 03, 2017 12:00 PM

Updated January 10, 2018 21:00 PM

Updated August 07, 2015 18:00 PM