I'm new to Vagrant and Virtual Box, but I've got this Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "debian-7.2.0"
config.vm.box_url = "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box"
config.vm.network :private_network, ip:"172.17.2.3"
config.vm.synced_folder("./data", "/vagrant", nfs: (RUBY_PLATFORM =~ /linux/ or RUBY_PLATFORM =~ /darwin/))
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
$script = <<EOF
mkdir -p /etc/puppet/modules
(puppet module list | grep puppetlabs-apt) ||
puppet module install puppetlabs-apt --version 1.4.2
EOF
config.vm.provision :shell, :inline => $script
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "base.pp"
puppet.options = ['--verbose --debug']
end
end
In my hosts
file I have:
172.17.2.3 local.dev
The problem is, when I go in browser to local.dev I see: "It works!" message, but not the index.php which is located in data/www/
(data
is in the same level as Vagrantfile)
How can I start working so I can load files from data/www
? Or is there any better approach?
The issue here is that the Apache2 web-server needs to be reconfigured and change the DocumentRoot.
Run vagrant ssh
and you will end up with a shell to the Virtual Machine. Change the DocumentRoot with sudo nano /etc/apache2/sites-available/default
and hit Ctrl+X hit Y and then Enter, run sudo service apache2 restart
to restart apache2 with the new configuration.