Search code examples
vagrantvirtualboxpuphpet

Understanding Vagrant Synced folder setup with the default & html folder


I'm working on getting a Vagrant setup running for the first time on a Windows 8.1 machine. I've been pouring over all the documentation to understand how it all works. I used puphpet to help me configure a Ubuntu 14 LAMP development box to use.

My confusion is around how the synced folders are setup. It seems that the synced folders on install, always create a new 'default' and 'html' folder in whatever local directory I specify in my puphpet setup. I then have to put any code files I want to run in the default folder.

For example: host folder: ./www ends up having /www/default and www//html in it after Vagrant up. Why is this occurring? I left the remote folder to the default /var/www.

My ideal setup was to have a Vagrant box folder setup on my machine, and then have my code project reside in the same directory as the Vagrant box files. However, it seems that I can only put the code project in the 'default' directory that Vagrant creates.

I can't find any mention of this in the documentation. Is this normal behaviour for this to be happening? If not, how can I get around this so that I can keep the code in whatever directory that I want?

Here's the relevant code from the puphpet config file: synced_folder:

            Rh7fCuil7xE4:
                source: ./www
                target: /var/www
                sync_type: default
                rsync:
                    args: '-z'
                    exclude: .vagrant/
                    auto: 'false'

Solution

  • Author of puphpet here.

    Nginx creates a folder for its default vhost (same with Apache). That's what those two folders are. It also appears there's a small bug in puphpet that will create both folders, even though one is the right one. I'll see about fixing it, but it shouldn't affect your VM in the slightest.

    /var/www is what you've defined as your target, so anything that appears in your master's ./www will also appear in your VM's /var/www and vice-versa.