Allow outside & other devices (phones, tablets,...) to access your local server using ngrok
-
Laragon 1.0.7 includes ngrok, an excellent tool to expose your local server behind a NAT or firewall to the internet.
This tutorial helps you to allow connections from outside to your [project.dev]- Make sure of our services is running (Start All), press Ctrl + Alt + T to open Terminal
Ctrl + Alt + T
- Run ngrok by typing: ngrok http project.dev:80
ngrok http project.dev:80
- Ngrok will start and show status screen, note for a domain which looks like this: xxxxxxxx.ngrok.io (in that case: 3e66ccf0.ngrok.io)
Forwarding http://3e66ccf0.ngrok.io -> project.dev:80
- Open http-vhosts.conf (Menu > Apache > http-vhosts.conf), and add the domain to ServerAlias of project.dev Virtualhost entry:
<VirtualHost *:80> #laragon magic! DocumentRoot "d:/laragon107.2/www/project/" ServerName project.dev ServerAlias *.project.dev, 3e66ccf0.ngrok.io </VirtualHost>
- Reload Apache (Menu > Apache > Reload). That's all.
DONE! You and your customers now can access your project.dev from anywhere using this url:
http://3e66ccf0.ngrok.io
Note: The url will be changed each time you run ngrok.
Some pics:
-
Run ngrok:
-
Add ngrok.io url to ServerAlias:
-
Reload Apache (You also can click Reload button in Laragon Interface):
-
This is even faster:
ngrok http -host-header=myapp.dev 80Just write this and it works.
-
@crissi : There are cases it doesn't work.
For example, if you have a Wordpress project: ** wp.dev**
When browsing http://xxxx.ngrok.io, the browser will redirect to http://wp.dev
-
there is a simplest way
- run the PHP server from the prefernces,
the project will work on port 8000, so if you have a website called project.dev it will work the same way but on localhost:8000
- then run ngork by typing:
ngrok http localhost:8000
- run the PHP server from the prefernces,
-
Hi @leokhoa , how can I make the same with ngnx?
-
I install apache and it works, how can I use project.local link in lan without having to see the ngrok's new link?