I use mamp and I have virtual hosts all on port 8888. For example:
would point to localhost/site1/
, localhost/site2/
etc.
Before using virtual hosts, I would just change my docroot to whatever project I was currently working on and would start ngrok like so
./ngrok http 8888
and it would launch and give me a random generated *.ngrok.io url.
My question is how do I specify the domain now since I am using virtual hosts?
I've tried ./ngrok http site1.dev:8888
and it starts but just serves up mamps webroot.
I am using a free account.
To do this, first, log in to your ngrok.com dashboard and click "Reserve Address" in the "Reserved TCP Addresses" section. Then use the -remote-addr option when invoking ngrok to bind a tunnel on your reserved TCP address. Make sure the -region you specify matches the region in which you reserved your address.
Steps: 1. Just run the ngrok in screen and then detach. 2. Use the python script given by Gerard above to see the URL.
Ngrok-dns is a plugin of sorts to the ngrok npm package that enables domain features of ngrok which are not available on the free plan. Ngrok-dns will create a TXT record pointing to the new tunnel each time it changes. Further you can generate a fixed URL using the service at https://ngrok-dns.june07.com.
If you prefer a free option, it is possible via:
$ ngrok http -host-header=site1.dev 80
You can use custom domains with this syntax:
ngrok http -hostname=dev.example.com 8000
For reference: https://ngrok.com/docs#custom-domains
But a paid plan is needed.
The correct way to use a custom subdomain name is follow:
ngrok http -subdomain=mycustomsubdomain 80
Will generate:
Forwarding http://mycustomsubdomain.ngrok.io -> 127.0.0.1:80
Forwarding https://mycustomsubdomain.ngrok.io -> 127.0.0.1:80
More in docs: https://ngrok.com/docs#http-subdomain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With