Requirements
To build
To run
Step 1 — Install dependencies
Step 2 — Build release binaries
target/release/rustunnel-servertarget/release/rustunnel
Step 3 — Create system user and directories
Step 4 — Install the server binary
Step 5 — Set up PostgreSQL
rustunnel requires PostgreSQL for shared state (tokens, tunnel history, audit log).Step 6 — Create the server config file
Create/etc/rustunnel/server.toml. Generate a strong admin token first:
Step 7 — TLS certificates (Let’s Encrypt + Cloudflare)
Both the bare domain and the wildcard are required. The wildcard (*.edge.rustunnel.com) is what makes HTTP subdomain tunnels work.
Create the Cloudflare credentials file:
rustunnel service user to read the certificates:
Step 8 — Set up the systemd service
Step 9 — Open firewall ports
Port 9090 only needs to be open if you have an external Prometheus scraper. If Prometheus runs on the same host it reaches the metrics endpoint over the loopback network.
Step 10 — Verify the server is running
Port 4040 is the control-plane WebSocket — clients connect here. Hitting it with plain HTTP returns
HTTP/0.9, which is expected. The dashboard REST API is on dashboard_port (8443 in the config above).Connecting a client
Updating the server
Pull the latest code, rebuild, install, and restart in one command:git pull → cargo build --release → install → systemctl restart → systemctl status.
Port reference
Config file reference
Monitoring
A Prometheus metrics endpoint is available at:9090/metrics:
Next steps
Client Guide
Configure the rustunnel CLI to connect to your self-hosted server.
Architecture
Understand the control plane, data plane, and yamux multiplexing under the hood.
Load Balancing & Health Checks
Run multiple backends behind one subdomain with automatic failover.
MCP Server
Let AI agents manage tunnels on your self-hosted server via MCP.

