Closed jgraup closed 7 years ago
Actually, I think I got this working. Maybe there is a dynamic way to pull the hostname from Vagrant so it doesn't need to be included in the command.
HOST="site.dev";
IP="$(vagrant ssh -- -t 'ip address show eth1 | grep "inet " | sed -e "s/^.*inet //" -e "s/\/.*$//" | tr -d "\n" | tr -d "\r"; ')";
PORT=80;
DASHBOARD="http://127.0.0.1:4040/";
echo -e "\nHOST:\t$HOST\nIP:\t$IP\nPORT:\t$PORT\n\tStarting ngrok "`date +%Y-%m-%d\ %H:%M:%S`... and opening $DASHBOARD"\n";
open $DASHBOARD;
ngrok http -host-header=$HOST $IP:$PORT
Now I just need a good relative URL plugin that works with a multisite install.
Throwing this in the wp-config.php
helps a bit.
// Convert all site URLs to relative links in PHP output
ob_start( function( $string ) {
$host = "site.dev";
return preg_replace( '/(http(?:s)?:\/\/)?(' . $host . ')(\/)?/mi', '/', $string );
} );
I'm curious if you've heard of ngrok? And if you've ever tried using it with one of these Basic WordPress Vagrant sites? Could be pretty powerful to open a quick tunnel for others to test your local dev site. Just need a solution to work with the Virtual Hosts.
ngrok - Secure tunnels to localhost.