How to Share Your Local WordPress Website with Ngrok on Ubuntu
Are you running a WordPress website locally using Local WP (formerly Local by Flywheel) and want to access it from another device or share it with a client or friend over the internet?
Using ngrok
, a powerful tunneling tool, you can expose your local site securely to the world in just a few commands.
🚀 What is Ngrok?
ngrok
is a tool that creates a secure tunnel from the public internet to your local machine. This is especially useful when:
-
You want to test your local WordPress site on a mobile device
-
You need someone to preview your project remotely
-
You're demoing your work in real time
🧱 Prerequisites
-
A working local WordPress site running in Local WP
-
Ubuntu (tested on Ubuntu 22.04 and similar)
-
Internet connection
-
Terminal access
🔧 Step 1: Install Ngrok on Ubuntu
Open your terminal and paste the following command:
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && \
sudo apt update && sudo apt install ngrok
This will:
-
Add the official ngrok repository
-
Update your package list
-
Install the
ngrok
tool
🧭 Step 2: Set Local WP to “localhost” Mode
Before using ngrok
, make sure Local WP is using Router Mode: localhost
-
Open Local WP
-
Go to Preferences > Advanced
-
Change Router Mode from
Site Domains
tolocalhost
-
Click Apply, then restart your site
Now your local site URL will look like:
http://localhost:10005
Note: The port may vary — check your site details in Local WP.
🔐 Step 3: Connect Ngrok to Your Account (Optional but recommended)
You can use ngrok anonymously, but creating an account gives more features (like custom subdomains).
-
Sign up / log in
-
Copy your auth token
-
Run in terminal:
ngrok config add-authtoken <your_token_here>
🌐 Step 4: Start the Tunnel
Let’s say your WordPress site runs on port 10005
(confirm in Local WP). Then run:
ngrok http 10005
You will see output like this:
Forwarding https://abc123.ngrok.io -> http://localhost:10005
🎉 That's your public link! You can now:
-
Open it on another device
-
Share it with a friend, client, or tester
-
Use it in browser or mobile
📥 Example Use
You have a local WP site at:
http://localhost:10005
After running ngrok
, you get:
https://swift-sun-8923.ngrok.io
You (or anyone else) can now open that https://
link and see your site as if it were hosted online!
🚫 How to Stop the Tunnel
When you're done, simply press:
CTRL + C
Ngrok will stop, and the public link will no longer work.
🔁 Reuse Later
Every time you run:
ngrok http 10005
You’ll get a new public link (unless you're on a paid plan with reserved domains).
To reuse the same domain, use:
ngrok http --subdomain=yourname 10005
(Requires a paid ngrok plan)
🔒 Security Tip
-
Your site is exposed publicly while the tunnel is open.
-
Don’t leave it running unattended.
-
Don’t share the link with people you don’t trust.
📌 Summary
Task | Command |
---|---|
Install ngrok | See Step 1 |
Start sharing site | ngrok http 10005 |
Stop sharing | CTRL + C |
Check IP address | ip a |
Add auth token | ngrok config add-authtoken <token> |
✅ Final Thoughts
Ngrok makes it incredibly easy to preview, test, and share your local WordPress site without setting up hosting or DNS. It’s perfect for development teams, freelancers, or students working on class projects.
Let me know if you want help:
-
Automating this process
-
Using custom domains
-
Or securing your tunnel with a password
Happy developing! 🧑💻🌐
Comments
Post a Comment