Skip to content

Instantly share code, notes, and snippets.

@fideloper
Last active February 29, 2016 06:23
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save fideloper/dab171a2aa646e86b782 to your computer and use it in GitHub Desktop.
Save fideloper/dab171a2aa646e86b782 to your computer and use it in GitHub Desktop.
Sample Vagrant file. This installs Ubuntu 12.04 (64 bit). The use of NFS in this manner requires your user's password (needs sudo access). This optionally also has my LAMP server provisioning script (PHP 5.5).
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/var/www",
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant",
id: "core",
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
# Optionally provision PHP
# config.vm.provision "shell", path: "https://gist.github.com/fideloper/7074502/raw/install.sh"
end
@kmaxat
Copy link

kmaxat commented Mar 27, 2014

I had to add these lines to Vagrantfile to access localhost:8080

config.vm.network "forwarded_port", guest: 80, host: 8080

Am i doing this wrong?

@Ilyes512
Copy link

Ilyes512 commented Apr 1, 2014

@kmaxat
If you have something like this in you Vagrantfile:

config.vm.network :private_network, ip: "192.168.33.10"

Then you could use 192.168.33.10 instead of localhost:8080

@toychicken
Copy link

Hi - my understanding is that, because the watched files are on the host machine, but the gulp / grunt / etc processes are on the guest machine, that it's very unreliable because of the complexity of mapping the file system updates from the host OS, to a potentially wildly different guest OS.

It's small comfort, but if you can run the gulp / grunt / etc on your host machine, you should see better results, but obviously this isn't helpful if you're trying to run something like forever or nodemon.

@oldhobbyist
Copy link

@Ilyes512 Just tested, and that specific line is giving me error when doing vagrant up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment