This is using ngrok Premium subscription which allows you to define your own regions and domain names. Furthermore instructions are for macOS.
Install ngrok and certbot from homebrew.
brew cask install ngrok
brew install certbot
Login to ngrok locally. Get your authtoken from ngrok.io.
ngrok authtoken ...
Do HTTP 80 tunnel for your ngrok personal domain:
ngrok http -region eu -hostname=mikko.eu.ngrok.io 80
Now we need to get our certificates issued by Let's Encrypt. Let's assume we are working in an empty directory called ./certs
, where we want to pull in our certificate files.
When the tunnel is running, in another terminal go to a working directory and do:
cd certs
certbot
certonly --standalone --preferred-challenges http -d mikko.eu.ngrok.io --work-dir . --logs-dir . --config-dir .
This will pull in the certificates over the ngrok HTTP 80 tunnel:
- Congratulations! Your certificate and chain have been saved at:
/Users/moo/code/token-swap/certs/live/mikko.eu.ngrok.io/fullchain.pem
Now we have real HTTPS certs, so we can do ngrok
tunnel to our local development environment.
Let's assume we are using Angular ng serve
that runs in port 4200.
Let's start ngrok
again:
ngrok tls -region eu -hostname=mikko.eu.ngrok.io -key certs/archive/mikko.eu.ngrok.io/privkey1.pem -crt certs/archive/mikko.eu.ngrok.io/fullchain1.pem 4200
Then start your Angular server:
ng serve --public-host mikko.eu.ngrok.io
Now you can reach your local Angular development environment through both URLs:
https://mikko.eu.grok.io
http://localhost:4200
More info:
More tips on ngrok info
DigitalOcean CertBot standalone guide