Skip to content

Instantly share code, notes, and snippets.

@jubstuff
Last active October 5, 2015 20:33
Show Gist options
  • Save jubstuff/4cc9eff7fa919af9a21b to your computer and use it in GitHub Desktop.
Save jubstuff/4cc9eff7fa919af9a21b to your computer and use it in GitHub Desktop.
Setup xip.io in VVV
server {
listen 80;
listen 443 ssl;
server_name sitename.dev www.sitename.dev ~^sitename\.\d+\.\d+\.\d+\.\d+\.xip\.io$;
root /srv/www/sitename/htdocs/;
include /etc/nginx/nginx-wp-common.conf;
}
# ....
config.vm.network :public_network
# .....
<?php
// ....
// Match any requests made via xip.io.
if ( isset( $_SERVER['HTTP_HOST'] ) && preg_match('/^(sitename.)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(.xip.io)\z/', $_SERVER['HTTP_HOST'] ) ) {
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
}
// ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment