LogoLogo
  • Getting Started
  • CLI
    • Docker
    • Config.yaml
  • GUI (SOON)
  • Tunnels Types
    • HTTP/s
      • HTTP/s plugins
      • HTTP/s apps
    • TLS
    • TCP
    • UDP
  • Reservations
    • Domain
    • Endpoint
  • Troubleshoot
    • Common errors
  • Tutorials
    • Expose a local web server
    • Expose Apache/Nginx web server
    • Share files from localhost
    • Use LocalXpose with Traefik
    • Expose PocketBase backend
    • Create a custom domain name
    • Make Let's Encrypt certificate
    • Access your IP camera remotely
    • Access your Raspberry Pi remotely
    • Sync your Keepass password manager
    • Expose localhost RASA chatbot for Telegram Integration
    • Expose your local Netdata Instance
    • Testing Stripe webhook
    • Expose localhost Kubernetes
    • Expose database server (PostgreSQL)
    • Exposing local Minecraft server
    • More Tutorials
Powered by GitBook
On this page
  • 1. Using HTTP Tunnel:
  • a. Prepare Apache/Nginx web server
  • b. Start HTTP tunnel
  • 2. Using TLS tunnel
  • a. Prepare Apache/Nginx web server
  • b. Start TLS tunnel
  • 3. Using TCP tunnel
  • a. Prepare Apache/Nginx web server as we did before in TLS and HTTP tunnel.
  • b. Start TCP tunnel

Was this helpful?

  1. Tutorials

Expose Apache/Nginx web server

This tutorial will explain how to expose a localhost Apache/Nginx web server and give it a shareable link that is accessible from the internet.

PreviousExpose a local web serverNextShare files from localhost

Last updated 2 years ago

Was this helpful?

There are multiple ways to reach our locahost web server depends on your requirements.

1. Using HTTP Tunnel:

a. Prepare Apache/Nginx web server

We will run Apache or Nginx web server through docker:

docker run -p 3000:80 httpd
docker run -p 3000:80 nginx

This will run Apache/Nginx web server in localhost:3000

b. Start HTTP tunnel

Run HTTP tunnel and point it to Apache/Nginx web server

loclx tunnel http --subdomain apache --to localhost:3000 

After creating the tunnel and getting a shareable link to our website, we can access the website through https://apache.loclx.io or http://apache.loclx.io.

2. Using TLS tunnel

a. Prepare Apache/Nginx web server

We will run Apache/Nginx web server through docker as we did with HTTP tunnel above:

docker run -p 3000:80 httpd
docker run -p 3000:80 nginx

This will run Apache/Nginx web server in localhost:3000

b. Start TLS tunnel

You either can:

  • Let LocalXpose client to terminate the TLS traffic by providing the TLS certificate , so in this case you don't need to configure your Apache/Nginx web server TLS settings for example:

loclx tunnel tls --to localhost:3000 --crt /path/to/crt.pem --key /path/to/key.pem
loclx tunnel tls --to localhost:443

Now the TLS tunnel will be accessible from the internet through https://your-domain.com.

Note that TLS tunnel will only accept connection from the internet on port 443.

3. Using TCP tunnel

Since HTTP works on top of TCP, then a TCP tunnel will also works.

a. Prepare Apache/Nginx web server as we did before in TLS and HTTP tunnel.

b. Start TCP tunnel

loclx tunnel tcp --port 8888 --to 3000

This will create a TCP tunnel us.loclx.io:8888, you can access your Apache/Nginx webserver from the internet through http://us.loclx.io:8888

Or configure your Apache or Nginx web server to deal with TLS termination by using mod_ssl module for Apache and for Nginx you can follow this tutorial , then you don't need to pass the TLS certificate to LocalXpose client for example:

Since you are using TLS tunnel to access your localhost webserver, you will not be able to use .

Since you are using TCP tunnel to access your localhost webserver, you will not be able to use .

Using HTTP Tunnel.
Using TLS tunnel.
Using TCP tunnel.
https://nginx.org/en/docs/http/configuring_https_servers.html
HTTP middlewares
HTTP middlewares