Skip to content

Reverse proxy with Lets Encrypt

NightDragon1 edited this page Nov 8, 2026 · 2 revisions

Version: applies to RCONductor 1.1. Parts marked (new in 1.1) are not in 1.0.

The panel's web port speaks plain HTTP. This page puts it behind jonasal/nginx-certbot, an nginx image that requests and renews a Let's Encrypt certificate by itself. nginx, panel and agent run in one Compose file; only nginx publishes ports.

You need:

  • a DNS name such as rcon.example.org that points to this host;
  • ports 80 and 443 reachable for Let's Encrypt: the default HTTP-01 challenge comes in on port 80 from the internet. If the panel must stay out of the internet, limit port 443 to your LAN or VPN in your firewall, or use a DNS-01 challenge as described in the image's documentation.

compose.yaml

Replace you@example.org and rcon.example.org.

services:
  nginx:
    image: jonasal/nginx-certbot:6
    restart: unless-stopped
    environment:
      CERTBOT_EMAIL: you@example.org
      STAGING: 0
    ports:
      - 80:80
      - 443:443
    volumes:
      - nginx_certs:/etc/letsencrypt
      - nginx_confd:/etc/nginx/user_conf.d
    networks:
      default:
        # Fixed, so that the panel can trust exactly this address.
        ipv4_address: 172.30.0.10

  panel:
    image: docker.io/nightdragon1/rconductor-panel:1
    restart: unless-stopped
    read_only: true
    cap_drop: [ALL]
    security_opt: ["no-new-privileges:true"]
    pids_limit: 256
    mem_limit: 1g
    # No ports: the web port is reached only through nginx.
    environment:
      RCD_PUBLIC_URL: https://rcon.example.org
      RCD_TRUSTED_PROXIES: 172.30.0.10
      RCD_AGENT_PUBLIC_ADDR: panel:8443
    volumes:
      - data:/data
      - secrets:/secrets
      - backups:/backups

  agent:
    image: docker.io/nightdragon1/rconductor-agent:1
    restart: unless-stopped
    read_only: true
    cap_drop: [ALL]
    security_opt: ["no-new-privileges:true"]
    pids_limit: 256
    mem_limit: 1g
    group_add: ["${DOCKER_GID}"]
    environment:
      RCD_PAIRING_TOKEN: "${RCD_PAIRING_TOKEN:-}"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - agent-secrets:/secrets

networks:
  default:
    ipam:
      config:
        - subnet: 172.30.0.0/24

volumes:
  nginx_certs:
  nginx_confd:
  data:
  secrets:
  backups:
  agent-secrets:

The subnet 172.30.0.0/24 is an example; pick one that is free on your host and change the two addresses with it.

What the panel settings do:

Variable Why
RCD_PUBLIC_URL The panel checks the Origin of every writing request and of the WebSocket against this URL; with https:// the session cookie is marked Secure. Invitation links use it too.
RCD_TRUSTED_PROXIES IPs or CIDR ranges, separated by commas. Only from these addresses the panel reads X-Forwarded-For (the client address for the audit log and the sign-in lockout) and X-Forwarded-Proto. Name only the proxy: a trusted address has no connection limit of its own.
RCD_AGENT_PUBLIC_ADDR The agent reaches the panel's agent port directly, never through nginx.

Server block for nginx

Save this as rconductor.conf, with your domain in server_name:

# WebSocket of the live console: pass the upgrade on.
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name rcon.example.org;

    # The image requests the certificate for server_name and names it after
    # the directory below live/.
    ssl_certificate         /etc/letsencrypt/live/rconductor/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/rconductor/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/rconductor/chain.pem;
    ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;

    location / {
        proxy_pass http://panel:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        # The panel pings every WebSocket every 30 seconds.
        proxy_read_timeout 1h;
    }
}

The image handles port 80 itself: it answers the Let's Encrypt challenge and redirects everything else to HTTPS. Host and X-Forwarded-Proto keep the origin the browser sees; X-Forwarded-For carries the client address, which the panel accepts only because nginx's address is in RCD_TRUSTED_PROXIES.

Start

echo "DOCKER_GID=$(stat -c %g /var/run/docker.sock)" > .env
docker compose up -d
docker compose cp rconductor.conf nginx:/etc/nginx/user_conf.d/rconductor.conf
docker compose kill -s HUP nginx
docker compose logs -f nginx

The first start computes Diffie-Hellman parameters and can take a few minutes. After the HUP the image reads the server block, requests the certificate and loads it. Then open https://rcon.example.org, sign in as admin with the password from docker compose logs panel | grep password:, and pair the agent as in Installation with Docker Compose.

To try it out first, set STAGING: 1: Let's Encrypt's staging service has far higher limits but gives a certificate browsers do not trust. Before you switch back to 0, request the certificate again by force, or certbot keeps the staging one:

docker compose exec nginx /scripts/run_certbot.sh force

After any change to the server block, copy it again and send HUP. To check it without a reload:

docker compose exec nginx nginx -t

Agents on other hosts

Agents on other hosts connect to the agent port 8443 of the panel directly. Its TLS ends at the panel, which agents pin by key, so never put it behind nginx or any other proxy. Publish it on the panel service and set the address agents reach it under:

  panel:
    ports:
      - "8443:8443"
    environment:
      RCD_AGENT_PUBLIC_ADDR: panel-host.lan:8443

See Agent on another host.

Clone this wiki locally