Enable public URL during development
Make your local development can be accessed with a public URL
Install ngrok
- Download ngrok
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
- Then run:
unzip ngrok-stable-linux-amd64.zip
- Connect to your account.
./ngrok authtoken your-authentication-token
- Get
your-authentication-token
fromhttps://dashboard.ngrok.com/
- This will add your authentication token to
~/.ngrok2/ngrok.yml
, a default configuration file.
Configure ngrok region
- Open ~/.ngrok2/ngrok.yml.
vi ~/.ngrok2/ngrok.yml
- Add
region
key and a valid region [us, eu, au, ap, sa, jp, in] (default: us). - To use Asia Pacific region, use the following configuration.
authtoken: your-authentication-tokenregion: ap
- Save a configuration and quit (:wq).
Start ngrok to serve a public URL
- Use the following command to start ngrok and forward a public URL to localhost port 8000.
./ngrok http 8000
- You will logging messages like this:
ngrok by @inconshreveableSession Status onlineAccount your-email-address (Plan: Free)Version 2.3.40Region Asia Pacific (ap)Web Interface http://127.0.0.1:4040Forwarding http://7bf181875b76.ap.ngrok.io -> http://localhost:8000Forwarding https://7bf181875b76.ap.ngrok.io -> http://localhost:8000Connections ttl opn rt1 rt5 p50 p900 0 0.00 0.00 0.00 0.00
- Press
ctrl+c
to exit the process.
Configure ngrok to serve multiple ports
- Open ~/.ngrok2/ngrok.yml
vi ~/.ngrok2/ngrok.yml
- Add the following contents:
authtoken: your-authentication-tokenregion: aptunnels:ui:addr: 3000proto: httpapi:addr: 3001proto: http
- Save a configuration (:wq) and start ngrok with a command:
./ngrok start --all
Credit
Loading comments...