- Setup and Boxes
- Starting and SSH into Box
- Syncing local folder to the virtual machine
- Setting up environment for the virtual machine
Now that we have provisioned our vagrant and installed nginx in it we now want our nginx to be accessed on our localhost. For that we need to make network port forwarding from virtual machine to the local machine.
Add this line in Vagrantfile
Vagrant.configure("2") do |config| config.vm.box = "hashicorp/precise64" config.vm.provision :shell, path: "provision.sh" config.vm.network :forwarded_port, guest: 80, host: 8000 end
to make the necessary setting changes in your vagrant box.
After the provisioning is done we have to start the server and check if the server is working and that port 80 of virtual machine is forwarded to the port 8000 of localhost.
For testing open localhost:8000 in your browser and check if the nginx message is coming in browser. If its showing the message everything is configured fine.