VagrantI thought it was about time I chucked my Vagrant LAMP stack into VCM, before I lost or broke it. For those unfamiliar with Vagrant, go do some reading!

It’s based upon a not-so-current version of Laravel Homestead. I switched it to the debian/jessie64 base box, and added an init shell script. The init script will run every time you run vagrant provision, so I have carefully crafted the script to ensure it will not break things when run multiple times.

Configure Folder Sharing

You can configure individual VirtualHosts in the sites section, within the sites.yaml file. First of all, you can define a shared folder to map from your host machine into the guest;

    - map: ~/Projects
      to: /var/www/

The above maps the Projects folder in my desktop’s “home” folder into debian at /var/www.

Configure VirtualHosts

You can now map folders within the share to Apache VirtualHosts. Add one per line, such as;

    - { map:, to: "/var/www/projects/public" }
    - { map:, to: "/var/www/another/public" }

Note that indentation is important here; the dashes are indented with four spaces, not a single tab character. The map keyword will map a domain to a folder from the Virtualbox shared folder (/var/www) to a VirtualHost definition in Apache. You will of course need to add your development domains to host file.

You can mount folders in the same way as you define sites (i.e. multiple shares).


Currently the configuration doesn’t handle database provisioning or persistence. The persistence aspect can be solved with a plug-in; bootstraping database creation would need to be added to the site provisioning script. It’s simple enough to navigate to and create whatever databases are required.

Michael is a Software Engineer working in the North West of England. Michael spends his days building hand-crafted PHP applications. Rumours of his super-hero status are currently unconfirmed. He savours his victories when solving difficult programming challenges; occasionally writing about them here, on his personal blog.