Determine web server root folder in Vagrant

Asked

Viewed 195 times

0

Follows 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 am doing to meet the following directory structure:

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

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

The way out of mine vagrant up is:

PS D:\Projetos\PHP\7> 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 determined permissions for the Windows "All" group.

  • Try replacing config.vm.synced_folder "." , "/Projects/PHP/public/" Then run Vagrant Provision

  • @Lukssys Continued the same thing :(

  • It’s a complicated... I also got a lot with Vagrant in the windows environment, whenever I solved a problem appeared another, only solved everything when I ran linux

  • @Lukssys I used Linux, I went back through Windows, now I’m using Vagrant kk, I managed to solve, it was the box that 'concatenated' a 'public' in the way, then just put .. / worked out

1 answer

0


I found out that the box scotch, edit the shared folder name by adding a /public on the way, soon would be:

D:/Projetos/PHP/public/public, so I altered ../public/ for ../ and it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.