I had a need to expose one of my DevKinsta vhosts to the public briefly using ngrok. It took me long enough to figure out, I thought I’d share the steps in case they might be useful to someone else.
- With your docker/DevKinsta environment running, run the following command in a fresh terminal:
docker pull ngrok/ngrok
- When that finishes, run the following command:
docker run --net=host -it -e NGROK_AUTHTOKEN=<your_auth_token> ngrok/ngrok:latest http --host-header=rewrite yoursite.local:443
Once ngrok launches, you should be able to browser your local site from the public URL provided.
Notes:
You’ll have to sign up for a free ngrok account to get an auth token. The trick that took me so long to figure out was to specify the https port (443) instead of 80, which is spelled out in all of the examples. Your local site of course will need to be available on https, but it does work. Anything else gives various cryptic errors that are simply not helpful in tracking down a solution.