Skip to content

Instantly share code, notes, and snippets.

@faffyman
Created February 28, 2017 15:29
Show Gist options
  • Save faffyman/db3ebe376ba1f85b806336601d1c8e9f to your computer and use it in GitHub Desktop.
Save faffyman/db3ebe376ba1f85b806336601d1c8e9f to your computer and use it in GitHub Desktop.
Use ngrok to expose a wordpress local dev site

First - Install NPM on the Vagrant VM

$ vagrant ssh
$ sudo apt-get install python-software-properties
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -

$ sudo apt-get install nodejs

Install ngrok

$ sudo npm install -g ngrok

For WordPress: Add Plugins to Fix URL rewrites

''You need to to force Wordpress to issue relative URLs. Any of these should do the trick.''

https://github.com/optimizamx/odt-relative-urls
http://wordpress.org/plugins/relative-url/ <-- I've tested this one!
http://wordpress.org/plugins/root-relative-urls/

Now Run Ngrok

$ cd /vagrant/web

''N.B. replace mydevsite.dev with your vagrant hostname ngrok http -host-header=mydevsite.dev 80''

This will show you the shareable URL e.g: http://f90e9293.ngrok.io This URL is only active while your ngrok tunnel is open and it will chaneg each time you run ngrok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment