Running a local server is an important part of web development. It allows developers to build websites, test applications, configure databases and troubleshoot errors directly from their computers before deploying projects to a live hosting environment.
However, there are situations where working exclusively on localhost becomes limiting. You might need to demonstrate a website to a client, test an API webhook from an external service or allow another developer to access an application running on your computer.
Fortunately, you don’t necessarily need to purchase web hosting or configure a public IP address to make this possible. With tunnelling tools such as LocalTunnel, Ngrok and Cloudflare Tunnel, you can generate a temporary public URL that forwards incoming requests to your local development server.
In this guide, we’ll explain how local servers communicate with public addresses, demonstrate how to expose a local application using LocalTunnel and explore alternative solutions for different development requirements.
Understanding Local Servers and Public Addresses
A local server is a service running on your computer or within a private network. Developers commonly access these services using addresses such as localhost or 127.0.0.1, followed by the port number assigned to the application.
For example, a development server running on port 3000 may be accessible through http://localhost:3000. This address normally refers to the computer on which the browser is running, meaning another person cannot simply enter it on their device to access your application.
Devices on the same local network may be able to access the application using the computer’s private IP address, provided the server is configured to accept those connections and the firewall permits them.
Accessing the application over the internet requires a different arrangement. One option involves configuring public IP addresses, router port forwarding and firewall rules. However, that approach can introduce additional security risks and may not work when an internet service provider uses carrier-grade NAT.
A tunnelling service provides another option by creating an outbound connection from your development computer to a remote service. The service then assigns a public URL and forwards incoming requests through that connection to your local application.
This approach is particularly useful for temporary demonstrations, remote testing and development workflows that do not require a permanently deployed website.
How Does a Local Server Become Publicly Accessible?
When you start a tunnelling application, it establishes a connection between your computer and the tunnelling provider. The provider then generates a public address that visitors can use to reach your local development server.
For example, suppose your application runs at http://localhost:3000. After establishing a tunnel, you might receive an address similar to https://example-subdomain.loca.lt.
When someone opens that public URL, the tunnelling service receives the request and forwards it to your application running on port 3000. The application’s response travels back through the tunnel to the visitor.
Because the tunnel is initiated from your computer, this method generally avoids the need to expose an inbound port directly through your router.
However, a public URL does not automatically make your application private or secure. Anyone who can reach an unrestricted tunnel address may be able to interact with the exposed service. Access controls remain essential whenever sensitive functionality is involved.
Steps to Create a Local Server with a Public Address
For this demonstration, we’ll use LocalTunnel, an open-source tunnelling tool that makes it possible to expose a local HTTP server through a publicly accessible URL.
LocalTunnel supports a straightforward command-line setup, making it suitable for developers who want to share a project temporarily without dealing with complicated network configurations.
1. Install and Start a Local Server
Before creating a public address, you need an application running on your computer. Your development environment may depend on the programming language or framework you’re using.
- XAMPP: Provides Apache, PHP and database tools commonly used for local PHP development.
- Laragon: A Windows development environment suitable for PHP applications, including Laravel and WordPress projects.
- Node.js: Supports JavaScript-based development servers and applications built with frameworks such as Express.
- Python: Includes a simple HTTP server that can be useful for testing static files.
For a quick demonstration using Python, open your terminal inside a folder containing a test HTML file and execute:
python -m http.server 3000 --bind 127.0.0.1
This starts a basic HTTP server on port 3000. Open your browser and visit:
http://localhost:3000
If the page loads successfully, your local server is running and ready to be connected to a tunnelling service.
Important: Python’s built-in HTTP server is intended for development and basic testing. It should not be used to host sensitive or production applications.
2. Install Node.js and LocalTunnel
LocalTunnel requires Node.js and npm. If you haven’t installed them, download the appropriate Node.js version from the official website and complete the installation.
After installation, open Command Prompt, PowerShell or your preferred terminal and check the installed versions:
node --version
npm --version
If both commands return version numbers, Node.js and npm are available on your computer.
You can now install LocalTunnel globally using:
npm install -g localtunnel
The global installation makes the lt command available from your terminal, allowing you to create tunnels without installing the package separately in every project.
Alternatively, you can run LocalTunnel without a global installation using:
npx localtunnel --port 3000
Both methods can expose a local server. The global installation is convenient for regular use, while the npx approach is useful when you only need the tool occasionally.
3. Expose Your Local Server to the Internet
With your application running on port 3000, open another terminal window and execute:
lt --port 3000
LocalTunnel will connect to its tunnelling service and provide a public URL. Depending on the service and available subdomains, the address may resemble:
https://example-subdomain.loca.lt
Copy the generated address and open it from another device or browser to test whether your local application is accessible.
Make sure the local server remains running while testing the public address. The tunnel also needs to remain connected for visitors to access your application.
You can stop the tunnel by pressing Ctrl + C in the terminal where LocalTunnel is running.
4. Request a Custom LocalTunnel Subdomain
LocalTunnel also supports requesting a particular subdomain instead of relying entirely on a randomly assigned name.
For example, you can run:
lt --port 3000 --subdomain myprojectdemo
If the requested name is available and accepted by the tunnelling service, your public URL may resemble:
https://myprojectdemo.loca.lt
Custom subdomains can make temporary demonstration links easier to recognise and share with clients or colleagues.
However, requesting a subdomain does not guarantee that it will be available. Free tunnelling services may also impose restrictions or change their access requirements.
5. Test the Public URL
After generating your tunnel address, test it from a device that isn’t relying on your computer’s localhost connection.
For example, you can open the address on a mobile phone using mobile data or ask a trusted colleague to test the link from another location.
Confirm that the website loads, images and stylesheets appear correctly, and application features behave as expected.
If you’re testing a website built with Laravel, WordPress or another framework, pay attention to generated URLs. Some applications may continue referencing localhost for images, scripts, redirects or API endpoints.
These issues often require adjustments to the application’s development configuration rather than changes to the tunnel itself.
How to Secure a Publicly Accessible Local Server
Exposing a development server can be convenient, but it introduces security considerations that should never be ignored.
Although tunnelling providers commonly supply HTTPS addresses, HTTPS only protects data in transit across the encrypted connection. It doesn’t automatically prevent unauthorised visitors from accessing your application.
Before exposing a local project, consider the following precautions:
- Use authentication: Protect applications with suitable login controls or access policies before sharing them publicly.
- Avoid production credentials: Never expose development environments containing real customer information, live database passwords or sensitive API keys.
- Disable debugging interfaces: Development error pages, database administration tools and debugging dashboards may reveal sensitive information.
- Use test data: Demonstrate applications with sample accounts and non-sensitive records whenever possible.
- Review access logs: Monitor requests where supported to identify unexpected activity.
- Close unused tunnels: Stop sharing your local application immediately after completing the demonstration or test.
Remember that sharing an unprotected public URL only with trusted people is not a substitute for authentication. URLs can be forwarded, logged or discovered through other means.
For projects that require stronger access restrictions, choose a tunnelling solution that supports authentication or an identity-based access policy.
Alternatives to LocalTunnel
LocalTunnel is useful for simple demonstrations, but other services provide additional capabilities for developers who need more control over traffic, public addresses or access permissions.
1. Ngrok
Ngrok is a tunnelling platform used for exposing local applications, testing webhooks and allowing external services to communicate with development environments.
It provides tools for managing public endpoints, inspecting requests and configuring traffic policies. Available features and usage limits depend on the selected plan.
After installing and configuring the Ngrok agent, a basic HTTP tunnel can be started with a command such as:
ngrok http 3000
This forwards requests from an assigned public endpoint to the application running locally on port 3000.
Ngrok can be useful when testing payment gateway callbacks, external API integrations and other workflows that depend on inbound HTTP requests.
2. PageKite
PageKite is another tunnelling solution that allows developers to make local web services accessible through public addresses.
It supports several platforms and can be used to share development websites, test remote connections and make privately hosted applications reachable over the internet.
PageKite uses relay servers to forward connections to local services. It also provides options for stable hostnames and different hosting requirements.
Developers who prefer an open-source tunnelling approach may find it useful, particularly when working with projects that need more flexibility than a temporary demonstration URL.
3. Cloudflare Tunnel
Cloudflare Tunnel allows developers and organisations to connect local applications to Cloudflare’s network without opening inbound ports on their routers.
It uses the cloudflared connector to establish outbound connections from the local environment. Cloudflare then routes incoming traffic to the configured application.
For temporary development testing, Cloudflare provides Quick Tunnels that can generate a public address without requiring a Cloudflare account or domain.
After installing cloudflared and starting your local server, execute:
cloudflared tunnel --url http://localhost:3000
Cloudflare will generate a temporary address using the trycloudflare.com domain. You can use that address to access your local development server from another device.
Quick Tunnels are intended for testing rather than permanent production deployments. They have limitations and do not provide guaranteed uptime.
For applications requiring stable hostnames, persistent connectivity and more advanced access management, Cloudflare also supports configured tunnels that can connect applications to custom domains.
LocalTunnel vs Ngrok vs Cloudflare Tunnel
The right tunnelling tool depends on your development requirements. LocalTunnel is generally straightforward for temporary sharing, while Ngrok provides additional tools for inspecting and managing inbound traffic.
Cloudflare Tunnel is particularly useful when you need integration with Cloudflare’s network and access management features. Its Quick Tunnel option also offers an accessible starting point for temporary testing.
PageKite provides another alternative for developers interested in exposing local applications through a relay-based tunnelling system.
Before selecting a service, consider whether you need a fixed domain, authentication, webhook testing, traffic inspection or reliable long-term availability. Free-tier restrictions and supported features may change, so consult the provider’s current documentation.
Common Problems When Exposing a Local Server
Even when the tunnelling command completes successfully, your application may not always load correctly through the public URL.
Public URL Shows a Connection Error
First, confirm that the local application is still running. Open http://localhost:3000 on the development computer and check whether the page loads.
If the local address fails, restart the development server before troubleshooting the tunnel. Also verify that the tunnelling command uses the correct port.
Website Loads Without CSS or Images
Missing stylesheets and images can occur when an application generates asset URLs pointing to localhost or another address that external visitors cannot reach.
Check your application’s base URL, asset configuration and browser developer tools for failed requests.
Frameworks such as Laravel may require temporary development configuration adjustments when serving an application through an external hostname.
Application Redirects to Localhost
Some applications use configured base URLs when generating redirects. If that address remains set to localhost, external visitors may be redirected to their own devices instead of your development server.
Review the relevant application URL settings and use an appropriate temporary configuration for testing. Restore the original settings after the demonstration.
Tunnel Stops Working Unexpectedly
Temporary tunnels generally depend on an active connection between your computer and the tunnelling provider. Restarting your computer, closing the terminal, losing internet connectivity or stopping the local server can interrupt access.
Restart the application and tunnelling client when necessary. A new temporary public URL may be assigned after reconnecting.
Practical Uses for Publicly Accessible Local Servers
Developers use public tunnelling addresses for several tasks that would otherwise require a live hosting environment.
- Client demonstrations: Allow clients to preview a website or application before deployment.
- Payment gateway testing: Receive development webhook notifications from supported payment providers without exposing live customer data.
- Remote API testing: Allow external applications to communicate with a development API.
- Mobile application development: Test how an application communicates with a backend running on a development computer.
- Team collaboration: Share a temporary demonstration environment with colleagues in different locations.
- Website debugging: Reproduce selected development issues using remote devices or browsers.
These use cases are most appropriate when the exposed application is designed for development or testing and does not contain sensitive information.
Frequently Asked Questions
Can I Access My Localhost Website from Another Computer?
Yes. If both computers are on the same network, you may be able to access the server using its private IP address, provided the application and firewall are configured correctly. For internet access from another location, a tunnelling service can generate a public URL.
Do I Need a Public IP Address to Use LocalTunnel?
No. LocalTunnel establishes an outbound connection to its service, so you generally don’t need to configure a public IP address or router port forwarding.
Can I Use a Public Tunnel for a WordPress Website?
Yes, but WordPress may require additional configuration because it generates links and redirects based on its site URL settings. Use a dedicated development installation and avoid exposing administration pages or sensitive data without appropriate protection.
Is It Safe to Expose Localhost to the Internet?
It can be done with appropriate precautions, but exposing a development application always introduces risk. HTTPS alone isn’t enough. Use authentication, test data, restricted permissions and suitable access controls before making the application reachable from the internet.
Can I Keep My Public URL Running Permanently?
Temporary tunnelling addresses normally depend on an active tunnel session. If you require a stable public hostname and long-term availability, consider a properly configured persistent tunnel or a conventional hosting environment.
Conclusion
Making a local server accessible from a public address is a practical skill for web developers, particularly when testing APIs, demonstrating client projects and collaborating with remote teams.
LocalTunnel provides a straightforward starting point because it can generate a public URL using a simple command. Ngrok, PageKite and Cloudflare Tunnel offer alternative approaches depending on the level of control, authentication and reliability your project requires.
The most important consideration is security. A publicly accessible development environment should never be treated as automatically protected simply because it uses an HTTPS address.
Start with a small test project, confirm that your local server works, establish a temporary tunnel and verify access from another device. Once you’re comfortable with the process, you can explore more advanced configurations for your development workflow.









