Contents
Developing and testing a website on a local computer is a common practice among web developers, designers, students, businesses and software development teams. A locally hosted website allows you to build pages, install applications, test features and make changes without immediately publishing the website on the internet.
However, there are situations where you may want other people to access your locally hosted website. For example, you may want to show a client your website design, allow a colleague to review your work, demonstrate a web application, test a payment integration or share a development project with someone working remotely.
The good news is that you do not always need to purchase hosting or upload your website to a live server to achieve this. Several technologies allow you to temporarily expose a locally hosted website to the public internet.
This guide explains how to share a locally hosted website publicly, the available methods, the tools you can use, their advantages and disadvantages, and the security precautions you should observe.
1. What Is a Locally Hosted Website?
A locally hosted website is a website that runs on your computer rather than on a publicly accessible web hosting server.
Developers commonly use local development environments to create and test websites before making them available online.
Some popular local development tools include:
- XAMPP
- WAMP
- Laragon
- MAMP
- Local (LocalWP)
- Docker
- Node.js development servers
- Python development servers
- Visual Studio Code Live Server
For example, if you are using XAMPP, your website may be accessible through:
http://localhost/mysite
If you are using WordPress with LocalWP, the application may provide a local development address such as:
http://mysite.local
Similarly, a website developed using Node.js may run at:
http://localhost:3000
These addresses are normally accessible only from your computer or, depending on network configuration, other devices on your local network.
To allow someone outside your network to access the website, you need to create a connection between your local development server and the public internet.
2. How Does Public Sharing of a Local Website Work?
When someone visits a locally hosted website, their browser normally communicates with a web server running on the same computer.
For public access, an intermediary connection is required.
This can be achieved using a tunnelling service, a reverse proxy, port forwarding or a temporary hosting environment.
The general process works as follows:
- You create and run your website on your computer.
- Your local web server listens on a particular port.
- A tunnelling service or network configuration establishes a connection to that port.
- The service provides a publicly accessible URL or domain.
- Another person opens the URL using their browser.
- Their request is forwarded to your local computer.
- Your local server processes the request and returns the website.
For example:
| Component | Example |
|---|---|
| Local website | http://localhost:8000 |
| Tunnelling service | Cloudflare Tunnel |
| Public address | https://example.trycloudflare.com |
| Visitor | Client using a remote browser |
| Destination | Your local computer |
The important point is that your website remains on your computer. The tunnelling service simply creates a route through which external visitors can access it.
3. Using Ngrok to Share a Locally Hosted Website
Ngrok is one of the popular tools for exposing locally hosted websites to the internet.
It creates a secure tunnel between your computer and a publicly accessible address.
It is particularly useful for developers who want to demonstrate a website without purchasing hosting or changing their existing development environment.
How to use Ngrok
Step 1: Install Ngrok
Visit the official Ngrok website:
Create an account and download the appropriate application for your operating system.
Step 2: Start your local website
Open your local development environment and start your web server.
For example, if you are using a development server running on port 8000, confirm that the website works locally:
http://localhost:8000
Step 3: Configure Ngrok
Follow the account setup instructions to configure your authentication token.
You can then open your terminal or command prompt and execute:
ngrok config add-authtoken YOUR_AUTH_TOKEN
Replace the placeholder with the authentication token provided by Ngrok.
Step 4: Create a public tunnel
Run:
ngrok http 8000
This command tells Ngrok to expose your local port 8000.
Step 5: Share your public URL
Ngrok will generate a publicly accessible HTTPS address.
For example:
https://example.ngrok-free.app
Anyone with the address can open your locally hosted website, provided the tunnel remains active and your local server is running.
Advantages of Ngrok
- Simple installation and configuration.
- Supports HTTPS connections.
- Works with many local development environments.
- Useful for client demonstrations.
- Supports webhook testing.
- Does not require router port forwarding.
Limitations
- Free-plan features and usage limits may apply.
- Temporary addresses may change between sessions.
- The tunnel stops working when the relevant process is stopped.
- Your computer must remain connected to the internet.
4. Using Cloudflare Tunnel to Publish a Local Website
Cloudflare Tunnel is another effective way to make a locally hosted website publicly accessible.
It establishes an outbound connection from your computer to Cloudflare’s network. This means you can expose a local website without opening an inbound port on your router.
Cloudflare Tunnel is particularly useful when you want to use your own domain name.
How to set up Cloudflare Tunnel
Step 1: Create a Cloudflare account
Visit:
Create an account if you do not already have one.
Step 2: Install Cloudflared
Cloudflared is the software that establishes the tunnel.
Download it from the official documentation:
https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/
Install the appropriate version for Windows, Linux or macOS.
Step 3: Start your local website
For example, if your website is running on port 8080, confirm that it opens at:
http://localhost:8080
Step 4: Create a temporary tunnel
For a quick demonstration, execute:
cloudflared tunnel --url http://localhost:8080
Cloudflare will establish a temporary tunnel and generate a public address under its trycloudflare.com domain.
Step 5: Share the generated address
Copy the HTTPS URL and send it to your client, colleague or website reviewer.
They can now access your local website remotely.
Using a custom domain
If you own a domain name, you can configure a named Cloudflare Tunnel and associate it with a hostname.
For example:
preview.example.com
This gives your website a more professional address when sharing it with clients.
A named tunnel requires additional configuration, including connecting your domain to Cloudflare and configuring the appropriate DNS and tunnel settings.
Benefits of Cloudflare Tunnel
- Does not require opening router ports.
- Supports encrypted HTTPS connections.
- Can work with custom domains.
- Suitable for development and demonstrations.
- Supports more advanced access control configurations.
- Can expose multiple local applications through different hostnames.
5. Using LocalTunnel to Share a Website
LocalTunnel is a lightweight option for developers who want to share a local development server without complicated network configuration.
It is commonly used with Node.js development environments.
How to use LocalTunnel
Step 1: Install Node.js
Download Node.js from:
Install it on your computer.
Step 2: Install LocalTunnel
Open your terminal and execute:
npm install -g localtunnel
Step 3: Start your local website
For example, start a development server on port 3000.
Step 4: Create a public URL
Execute:
lt --port 3000
LocalTunnel will generate a public URL that you can share with other people.
For example:
https://example.loca.lt
Step 5: Test your website
Open the generated URL in another browser or send it to someone outside your local network.
Your website should now be accessible through the public address while the tunnel and local development server remain active.
Advantages of LocalTunnel
- Simple installation.
- Free and convenient for basic demonstrations.
- Suitable for Node.js applications.
- Does not require router configuration.
- Useful for sharing temporary development projects.
However, availability and reliability may vary because LocalTunnel depends on its public service infrastructure.
6. Using Port Forwarding on Your Router
Another method of sharing a locally hosted website is through router port forwarding.
Unlike tunnelling services, port forwarding involves configuring your internet router to direct incoming connections to your computer.
For example, if your local website runs on port 80, you can configure your router to forward incoming traffic on a selected external port to port 80 on your computer.
How port forwarding works
Suppose your computer has the following configuration:
| Setting | Example |
|---|---|
| Local IP address | 192.168.1.100 |
| Website port | 80 |
| Public IP address | 105.xxx.xxx.xxx |
| External port | 8080 |
Your router can be configured to forward incoming requests on external port 8080 to your computer at 192.168.1.100 on port 80.
A visitor could then access your website using your public IP address and port.
Steps for configuring port forwarding
- Identify your computer’s local IP address.
- Confirm the port on which your web server is running.
- Open your router’s administration interface.
- Find the port forwarding or virtual server settings.
- Create a forwarding rule directing external traffic to your computer.
- Reserve a fixed local IP address for your computer.
- Configure your firewall to allow the necessary traffic.
- Test access using an external internet connection.
Important considerations
Port forwarding requires additional security precautions.
You should not expose development services, database management interfaces, administrative dashboards or other sensitive services directly to the internet.
You should also consider whether your internet provider uses Carrier-Grade NAT (CGNAT). If it does, ordinary router port forwarding may not work because you may not have a directly reachable public IP address.
Some internet providers offer public IP addresses as an additional service.
For most beginners, a secure tunnelling solution is easier than configuring port forwarding.
7. Using Tailscale Funnel to Share a Local Website
Tailscale is a networking platform that allows computers and devices to communicate securely.
Its Funnel feature can expose selected services on your computer to the public internet.
This is useful when you want to share a development application without directly configuring your router.
Basic setup
Step 1: Install Tailscale
Visit:
Download and install the application.
Step 2: Connect your device
Sign in and connect your computer to your Tailscale network.
Step 3: Start your local server
For example:
http://localhost:3000
Step 4: Configure Funnel
Enable Funnel according to the current Tailscale setup instructions and expose the required local service.
A typical command for an application running on port 3000 is:
tailscale funnel 3000
Step 5: Share the public address
Tailscale provides a public HTTPS address associated with your device’s network identity.
People can use that address to access the exposed application.
Consult the official documentation for current Funnel availability, account requirements and configuration:
https://tailscale.com/kb/1223/funnel/
8. Comparing the Different Methods
There are several ways to share a locally hosted website publicly. The best choice depends on your technical knowledge, project requirements, security needs and whether you want temporary or long-term access.
| Method | Main purpose | Custom domain | Technical difficulty |
|---|---|---|---|
| Ngrok | Temporary public sharing | Available options | Easy |
| Cloudflare Tunnel | Secure public access | Yes | Easy to moderate |
| LocalTunnel | Quick development demonstrations | Limited | Easy |
| Router Port Forwarding | Direct access to a local server | Yes, with DNS configuration | Moderate to advanced |
| Tailscale Funnel | Public access to selected services | Tailscale-provided address | Moderate |
| Temporary cloud hosting | Hosting a separate online copy | Usually | Moderate |
For most developers, Ngrok and Cloudflare Tunnel are convenient starting points.
Cloudflare Tunnel is particularly useful when you want to demonstrate a project using a custom domain.
9. Sharing a Locally Hosted WordPress Website
WordPress is one of the most commonly used content management systems for building websites locally.
Developers frequently use XAMPP, LocalWP, WAMP and similar applications to develop WordPress websites before publishing them.
Suppose you have created a WordPress website using XAMPP.
Your local website may be available at:
http://localhost/mywebsite
You can expose the Apache web server through a tunnel.
For example, if Apache is listening on port 80, you can use:
ngrok http 80
Alternatively, you can use Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:80
However, WordPress websites require additional attention.
Important WordPress configuration issues
1. WordPress site URL
WordPress stores its website address in its configuration and database.
If your website was installed using localhost/mywebsite, it may continue generating links that point to localhost.
Remote visitors cannot access your computer through their own localhost address.
You may therefore need to configure the WordPress Address and Site Address appropriately for the temporary public hostname.
2. Images and media files
Images may fail to load if their URLs still point to the local development address.
Check image paths, CSS files, JavaScript files and other media resources.
3. Permalinks
Some WordPress installations may require you to refresh their permalink settings after changing the website URL.
4. SSL and HTTPS
When using a public HTTPS tunnel, ensure that your WordPress configuration and application resources work correctly with HTTPS.
5. Redirects
Some plugins and themes may redirect visitors to your original local address.
Check your website’s redirects before sharing the public URL.
For a temporary demonstration, you may need to adjust your local WordPress configuration and restore it afterwards.
For long-term sharing, consider creating a proper staging website instead.
10. How to Share a Website Hosted on XAMPP
XAMPP provides Apache, MariaDB, PHP and other components required to run PHP websites locally.
It is frequently used for developing WordPress websites, PHP applications and custom content management systems.
Suppose your website is stored in:
C:\xampp\htdocs\businesswebsite
You can access it locally through:
http://localhost/businesswebsite
To share it publicly, follow these steps:
- Open the XAMPP Control Panel.
- Start Apache.
- Start MySQL if your website requires a database.
- Confirm that the website opens locally.
- Identify the Apache port, usually 80 or 8080.
- Start Ngrok or Cloudflare Tunnel using the correct port.
- Copy the generated public URL.
- Test the website using another device or internet connection.
For example, if Apache runs on port 80:
ngrok http 80
If Apache runs on port 8080:
ngrok http 8080
Remember that the public URL may need to include the project directory.
For example:
https://example.ngrok-free.app/businesswebsite
Also ensure that your PHP application is not configured to use inaccessible local URLs.
11. How to Share a Locally Hosted Website With a Custom Domain
Sometimes a temporary URL is not suitable, especially when demonstrating a business website to a client.
A custom domain can make the project look more professional.
For example, instead of sharing:
https://example.trycloudflare.com
You may want to share:
https://preview.yourdomain.com
There are several ways to achieve this.
Option 1: Cloudflare Tunnel
You can connect your domain to Cloudflare, create a named tunnel and configure a DNS hostname that points to the tunnel.
Your local website remains on your computer, but visitors access it through your chosen domain.
Option 2: Ngrok custom domains
Ngrok provides custom domain capabilities under eligible plans and configurations.
You can configure a domain or subdomain to direct traffic through your Ngrok endpoint.
Option 3: Dynamic DNS
Dynamic DNS services can associate a domain name with a changing public IP address.
This approach is useful when using router port forwarding, although it does not eliminate the security considerations associated with directly exposing a local server.
A custom domain is particularly helpful when presenting websites to business owners, customers and other stakeholders.
12. How to Share a Local Website With Someone on the Same Wi-Fi Network
Not every website demonstration requires access through the public internet.
If the person you want to share your website with is connected to the same Wi-Fi network, you can often share it using your computer’s local network IP address.
For example, your computer may have the address:
192.168.1.100
If your website runs on port 8080, another device may access it through:
http://192.168.1.100:8080
Steps
- Connect both devices to the same Wi-Fi network.
- Find your computer’s local IP address.
- Configure your development server to listen on the network interface rather than only localhost.
- Allow the necessary connection through your computer’s firewall.
- Share the local IP address and port.
For example, a Node.js application may need to listen on 0.0.0.0 rather than 127.0.0.1.
This makes the development server accessible through the computer’s network interfaces.
The method is suitable for office demonstrations, classroom projects and testing websites on mobile devices.
However, it does not make the website accessible to people outside your local network.
13. Security Precautions When Sharing a Local Website Publicly
Making a local website publicly accessible can introduce security risks.
Your development computer may contain files, databases, credentials and applications that should never be accessible to external visitors.
Before sharing your website, consider the following precautions.
1. Protect your database
Do not expose phpMyAdmin, MySQL administration tools or database management interfaces publicly.
These services can give visitors access to sensitive information.
2. Disable unnecessary services
Only expose the web server port required by your website.
Avoid exposing SSH, FTP, database ports and other administrative services unless absolutely necessary and properly secured.
3. Use HTTPS
Where possible, use a tunnelling service that provides HTTPS encryption.
This helps protect information transmitted between the visitor and the public endpoint.
4. Protect administrator accounts
Use strong passwords for WordPress administrators, website dashboards and other management interfaces.
5. Avoid using real customer information
A development website should ideally use sample data.
Do not expose private customer records, payment details or confidential business documents.
6. Restrict access where possible
If the website is intended for a particular client, use access controls such as authentication, password protection or an access policy.
7. Keep your software updated
Update your local server software, content management system, plugins and development tools.
8. Stop the tunnel when finished
Once the demonstration is complete, stop the tunnelling service.
This prevents unnecessary public access to your development environment.
Security reminder: A publicly accessible tunnel should be treated like a public website. Anyone who obtains its address may be able to access the exposed application unless additional access controls are configured.
14. Common Problems When Sharing a Locally Hosted Website
Sometimes a website works perfectly on your computer but fails when someone opens the public URL.
The following table explains common problems and their possible solutions.
| Problem | Possible cause | Recommended solution |
|---|---|---|
| Website does not load | Local server is stopped | Start Apache, Nginx or the relevant development server |
| Connection refused | Incorrect port number | Confirm the server’s listening port |
| Images are missing | Local image URLs | Update image paths and website URLs |
| CSS is not loading | Incorrect asset paths | Check CSS and JavaScript references |
| WordPress redirects to localhost | Incorrect site URL | Correct WordPress Address and Site Address |
| Database connection error | Local database is stopped | Start MySQL or MariaDB |
| Public URL stops working | Tunnel has been closed | Restart the tunnel |
| External visitors cannot connect | Firewall or network restrictions | Review firewall rules and tunnel configuration |
| Port forwarding fails | CGNAT or incorrect router settings | Check public IP availability or use a tunnel |
| HTTPS warnings | Mixed content or SSL configuration | Correct insecure resource URLs |
Testing your public website
Before sending the link to another person, test it using:
- A different browser.
- A mobile phone.
- A different internet connection.
- An incognito or private browsing window.
- A device outside your local Wi-Fi network.
This helps identify problems that may not be visible when you are accessing the website directly from your development computer.
15. When Should You Use Temporary Tunnelling Instead of Web Hosting?
Temporary tunnelling and conventional web hosting serve different purposes.
A tunnel is designed to expose an application that is running on your computer. Web hosting provides an environment where a website can remain available independently of your personal computer.
| Requirement | Local tunnelling | Conventional web hosting |
|---|---|---|
| Quick client demonstration | Excellent | Good |
| Testing website designs | Excellent | Excellent |
| Temporary project sharing | Excellent | Good |
| Permanent business website | Not recommended | Recommended |
| Continuous availability | Depends on your computer and tunnel | Depends on hosting uptime |
| Custom domain | Supported by some services | Commonly supported |
| Server management | Your computer manages the application | Hosting provider manages the hosting infrastructure |
| Production traffic | Generally unsuitable without careful architecture | More suitable |
If you only want to show a website to a client for a few hours or days, a tunnel is often sufficient.
However, if you want customers to visit your website at any time, you should deploy it to a suitable hosting platform.
16. Best Practices for Demonstrating Websites to Clients
When sharing a website with clients, it is important to make the demonstration as smooth as possible.
Consider the following recommendations:
- Test every page before sending the link.
- Confirm that images and other media load correctly.
- Check the website on desktop and mobile devices.
- Use a professional temporary domain where possible.
- Ensure that navigation menus and buttons work.
- Test forms and other interactive features.
- Avoid exposing unnecessary development tools.
- Explain that the link is temporary if you are using a temporary tunnel.
- Keep your computer connected to the internet throughout the demonstration.
- Stop public access when the demonstration is complete.
If you are presenting a website to a business owner, you may also create a password-protected preview environment so that only authorised people can access the project.
17. Frequently Asked Questions (FAQs)
1. Can I share my localhost website with someone in another country?
Yes. You can use services such as Ngrok, Cloudflare Tunnel or Tailscale Funnel to create a public connection to your locally hosted website. The other person can access it through the generated URL.
2. Can someone access my localhost website without installing anything?
Yes. The website owner needs to install and configure the tunnelling application, but visitors normally only need a web browser and the public URL.
3. Does sharing a local website publicly mean that I need hosting?
No. A tunnelling service can make your local website accessible without purchasing conventional web hosting. However, your computer must remain switched on, connected to the internet and running the website.
4. Can I share a WordPress website running on XAMPP?
Yes. You can expose the Apache port through a tunnelling service. You may also need to adjust WordPress URLs, image paths and redirects to ensure the website works correctly for external visitors.
5. Can I use my own domain when sharing a local website?
Yes. Services such as Cloudflare Tunnel and eligible Ngrok configurations allow you to associate a custom domain or subdomain with your locally hosted website.
6. Is Ngrok free?
Ngrok offers a free plan with limitations. Available features, usage allowances and domain options depend on its current pricing and account terms.
7. Is Cloudflare Tunnel better than Ngrok?
Both are useful. Ngrok is convenient for quick demonstrations and development testing. Cloudflare Tunnel is particularly useful for developers who want to connect a custom domain and establish a longer-running tunnel.
8. Can I share my local website using my mobile phone?
Yes. You can access a publicly exposed local website using a mobile browser. You can also use a mobile phone on the same Wi-Fi network to test the website using your computer’s local IP address.
9. Will my local website remain online after I switch off my computer?
No. If the website is running directly on your computer, switching it off stops the local server and normally terminates public access through the tunnel.
10. Is it safe to expose my local development website to the internet?
It can be safe when properly configured, but it introduces security risks. Use HTTPS, strong passwords, access restrictions and firewall rules. Never expose database administration tools or sensitive development services unnecessarily.
Sharing a locally hosted website publicly is a practical way to demonstrate development projects, collect feedback, test applications and collaborate with people working remotely.
You do not necessarily need to purchase web hosting or transfer your website files to an external server. Tools such as Ngrok, Cloudflare Tunnel, LocalTunnel and Tailscale Funnel allow you to create public connections to websites running on your computer.
For beginners, Ngrok and Cloudflare Tunnel are good starting points. They reduce the complexity of network configuration and make it easier to share a website through a public HTTPS address.
If you are working with WordPress, XAMPP, PHP, Node.js or another local development environment, the most important requirement is to identify the correct local server port and configure your tunnelling tool to expose it.
For temporary demonstrations, local tunnelling is convenient and cost-effective. For permanent business websites, however, conventional web hosting or a production cloud deployment remains the better choice.
Ultimately, learning how to share a locally hosted website publicly gives developers more flexibility when testing, presenting and collaborating on websites before making them officially available online.
