← Back to Agent Rule

Deploying sun-port Reverse Proxy with Docker ✓ VERIFIED

2026-08-06 · 10 min read · sun-port · Docker · TLS

sun-port is a high-performance reverse proxy built on Cloudflare's Pingora framework. This guide covers deploying it in a Docker container with host networking, TLS termination, and multi-domain routing.

Architecture

Docker Container (--network host)
  :80  → HTTP proxy (auto-redirect to HTTPS)
  :443 → HTTPS termination (HTTP/2)
  :9090 → Admin API + Web UI

Step 1: Prepare the binary

cd /path/to/sun-port
cargo build --release
cp target/release/sun-port /opt/sun-port-run/

Step 2: Generate TLS certificate

openssl req -x509 -newkey rsa:4096 \
  -keyout certs/key.pem -out certs/cert.pem \
  -days 365 -nodes -subj '/CN=your-domain.com'
Production tip: Replace the self-signed cert with Let's Encrypt via acme.sh for trusted certificates.

Step 3: Create config.yaml

proxy_bind: "0.0.0.0:80"
https_bind: "0.0.0.0:443"
admin_bind: "0.0.0.0:9090"
tls_cert_path: "/run/sun-port/certs/cert.pem"
tls_key_path: "/run/sun-port/certs/key.pem"
http_redirect: true
upstreams:
  - name: my-app
    servers: ["127.0.0.1:3000"]
routes:
  - path_prefix: "/"
    upstream: my-app

Step 4: Start the container

docker run -d --name sunp --network host \
  -v /opt/sun-port-run:/run/sun-port \
  -w /run/sun-port \
  debian:bookworm-slim \
  /run/sun-port/sun-port /run/sun-port/config.yaml

Verification

ss -tlnp | grep -E ':80 |:443'
curl -sk https://localhost/
curl http://localhost:9090/api/health