Question about symbolic links and grav setup in virtual environment


I’m playing around with a server setup and grav for a while now. I’ve set up a server environment inside a virtualbox virtual machine running arch linux. It runs an apache 2.4 server with php 5.6 and of course grav which is 1.0.4 at the moment of writing.
Apache runs with my user and group. Grav is placed in the document root which is /srv/http/.
The virtual machine shares a folder with my host system which is mounted at /media/sf_shared.
I made a symlink inside the doc root to access this share directly /srv/http/virtual/. The shared folder uses a group vboxsf and my user is a member of this group.
With this setup I can develop sites on my host system and have them presented by the virtual server.

I wanted to setup grav to use this system and tried different things.
At first I had multiple grav instances for every site for example /media/sf_shared/grav-site. This was ok but rather slow.
So I placed grav inside the doc root directly on the virtual server. But now I don’t have access to the user folder any longer. I read through the Symbolic Links section on and thought I can symlink the user folder. So I placed the user folder at /media/sf_shared/grav-user-folder/ and made a symlink inside grav /srv/http/grav/user.
The pages show up in the browser but I have no control via /bin/gpm. For example if I try to install a plugin I get invalid cross-device link at the moment where the files have to be copied from the cache folder to the destination inside the user folder.

I don’t know how to realise my idea of shared access to files in these two environments using grav.
Is it wrong to use symlinks to user folders like this? Is there something I’m missing. Is it a good idea to realise it this way?

Symlinks on the same machine are totally valid and we use them all day long in our Grav development setups. In fact I generally have 1 single Grav install that is cloned from GitHub, and then this is symlinked in to over a 100 individual Grav sites.

Usually I setup a site with bin/grav sandbox -s ~/Sites/new-grav-site to give me a symlinked new Grav site that I can develop on.

However, working with a remote filesystem and symlinks between ‘servers’ is going to cause problems. Your virtualized system is equivalent to running multiple servers. These have their own filesystems and internally use file system mounting to cross link these filesystems and create a virtual filesystem. This is going to make things VERY slow for a file-based CMS such as Grav.

I have setup Vagrant boxes for testing where I have the webserver and the files located locally in the Vagrant VM, then I simply access these files via a shared folder. Editing remotely (even into a VM) is not a big deal, and the performance of opening and saving files is totally manageable. However, because the f iles are all local to the webserver, performance of the site is excellent.

You can still symlink all over the VM filesystem. So you could have your sites served from one directory while your user folder is symlinked to another. You just need to ensure the users and permissions are aligned so that the webserver’s user/group is read/write compatible with the user/group of the files.

Good Luck!


Thank you very much for your detailed explanation. It helps me a lot on my journey :smiley:
I needed some time to take the first steps with vagrant but now have it setup and I’m happily working with grav now.

Best whishes from germany. Have a great christmas time.