Integrating xip.io With VVV

I’ve recently been seeking a easy way to enhance my workflow for QA’ing projects on multiple devices. There are many great options available, but all seem to have their pitfalls. Being a Vagrant user, I wanted to discover a process that would work in conjunction with VVV.

After some research, I stumbled upon an Github issue that referenced the use of xip.io with VVV. After digging into the blog posts referenced in the issue, I setup my local environment to utilize xip.io with a local instance. One problem I found is that the links provided did not provide enough detail so that anyone could setup this type process. The goal of this post is to provide enough detail that the average VVV user could setup their local dev environment to use xip.io.

Prerequisites:

* For this tutorial, you will need to know how to insert and save in VIM. Insert will be used to edit text and save will obviously save your work. To insert in VIM, typei. To save changes will in VIM, clickesc, then type:wq.

*** Note: If VVV is currently running, runvagrant halt before continuing.

1. Add a CustomFile to VVV

In your local VVV directory, a CustomFile will need to be added. I’ve created this file already and you can run the following commands in a terminal session to add it into your VVV install:

2. Edit the Nginx .conf file

The next step is to edit the Nginx .conf file associated with the local instance that you would like to support VVV. Run the following steps in a terminal session:

Once the .conf file has opened, locate theserver_name option and add the new option show below:

3. Edit VVV-hosts

The next step is to edit the vvv-hosts file associated with your local instance. If you are using the aforementioned site wizards, this is located in the base directory for the site instance. You will also need the IP address of your local machine that was mentioned earlier. Run the following commands in a terminal session to edit your vvv-hosts file:

After the vvv-hosts file has opened, arrow down to the last line of the file and on a new line, add the following line:

4. Vagrant Up

From your local VVV folder run the following commands:

You may need to provision also, if this is the case you can either tag thevagrant up with--provision or after VVV has has started, runvagrant provision

5. Install the Dynamic Hostname plugin

One of the last steps is to install the Dynamic Hostnames plugin. This can be found on the WordPress.org Plugin repository.

6. Edit wp-config.php

Finally, two options will need to be added to the wp-config.php file associated with the instance that will be using xip.io. Add the following two lines of code to wp-config.php right before/* That's all, stop editing! Happy blogging. */:

You should now be able to access your local site on any device using the newly added domain in vvv-hosts.

Credits: Original post about this was by Sal Ferrarello at http://salferrarello.com/vagrant-vvv-setup-wordpress/.