Determine web server root folder in Vagrant

0

Follow my Vagrantfile :

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

    config.vm.box = "scotch"
    config.vm.network "private_network", ip: "192.168.33.107"
    config.vm.hostname = "scotchbox"
    config.vm.synced_folder "../public/", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

    # Optional NFS. Make sure to remove other synced_folder line too
    #config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

end

I'm doing to meet the following directory structure:

-| D
---| Projetos
-----| PHP
-------| 5
-------| 7
-------| public

Where in the PHP directory, I have different machines with distinct php versions, and in the same folder I have public , where I will put my projects, the idea is to share this directory as if it were my /var/www of all machines, in theory my Vagrantfile is working, the machine connects normally, but accessing the IP from it by the browser is given 404 Not Found , what can be?

The output of my vagrant up is:

PS D:\Projetos\PHP> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
[default] GuestAdditions 5.1.10 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /var/www => D:/Projetos/PHP/public
    default: /vagrant => D:/Projetos/PHP/7
==> default: Machine already provisioned. Run 'vagrant provision' or use the '--provision'
==> default: flag to force provisioning. Provisioners marked to run always will still run.

Note: I have already set permissions for the Windows "Everyone" group.

    
asked by anonymous 13.12.2016 / 14:41

1 answer

0

I found that the scotch box, edits the name of the shared folder, adding a /public to the path, so it would look like:

D:/Projetos/PHP/public/public , so I changed ../public/ to ../ and it worked.

    
13.12.2016 / 16:48