Reputation: 463
Using Laragon, I've created a WordPress site on my local machine for testing a plugin I'm developing. Laragon creates virtual hosts for projects and I can access my wordpress site locally at wp001.test, which is normal since my project is named wp001.
If I run ngrok like so I can browse my site externally using the dynamically generated ngrok domain:
ngrok http -host-header=rewrite wp001.test:80
I signed up for a pro ngrok account so I could use a reserved domain name. I created my reserved domain name on the ngrok dashboard.
Now I can get ngrok to accept my reserved domain like so:
ngrok http -hostname=my-reserved-domain.ngrok.io 80
Then I can browse to my-reserved-domain.ngrok.io
but it's taking me to the web root of the file system (C:\laragon\www
) instead of making use of the virtual host.
How can I make ngrok use my reserved domain with the virutal host? I've read the ngrok docs but I'm just not seeing it.
Upvotes: 1
Views: 1659
Reputation: 463
I was able to make this work by using an ngrok config file. The file looks like this:
web_addr: localhost:4041
# ngrok auth config
authtoken: your_token_goes_here
tunnels:
your-tunnel-name:
proto: http
hostname: your-reserved-ngrok-domain.ngrok.io
addr: 127.0.0.1:80
# -------------------------
# Additional options
# -------------------------
# auth: "username:password"
host_header: your-virutal-host.com:80
# inspect: true
# bind_tls: true
Then starting ngrok and specifying the config file:
ngrok start -config=path/to/your/conf/file.yml --all
Upvotes: 1