Caddy Proxy Manager

Configuration

Most settings live in the web UI under Settings > Global. Environment variables are only needed for the start-up and for first-time defaults.

Environment variables

Variable Default What it does
CPM_PORT 8080 Port of the web UI
CPM_DATA_DIR ./data (/data in Docker) Where the database, secret key and logs are stored
CPM_CADDY_ADMIN_URL none First Caddy Admin URL (change it later in the UI)
CPM_SECRET generated Key for login cookies. Saved in secret.key when generated
CPM_LOG_LISTEN :9514 Address where CPM receives logs from Caddy
CPM_LOG_ALLOW anyone IPs or networks allowed to send logs, comma-separated (for example 192.168.1.10,10.0.0.0/8)
CPM_CONFIG_MODE file in the all-in-one image, otherwise memory First storage mode: memory or file (File + load)
CPM_CONFIG_DIR none Folder where CPM writes the Caddyfile
CPM_CADDY_CONFIG_DIR same as above The same folder as Caddy sees it (only when paths differ)
CPM_LOG_ADDRESS none First value for Logs to Caddy Proxy Manager
CPM_ADMIN_LISTEN 0.0.0.0:2019 First value for Admin listen (in Caddy)
CPM_CADDY_RUN none Command to start Caddy (all-in-one image only)

The all-in-one image already sets the right values. Old SCPM_* names still work.

Configuration storage

The database in /data always holds everything. When CPM starts, it loads the config into Caddy again, so recreating the container is safe.

The storage mode only matters when Caddy restarts on its own while CPM keeps running:

Mode What CPM does After a Caddy-only restart
File + load (recommended) Also writes the Caddyfile to disk Caddy reads the same files, even without CPM
Memory Sends the config to Caddy only Caddy is empty until you click Re-apply (or Caddy runs with --resume)

Use File + load. Memory is only for Caddy on another machine, which is not recommended. The Test button checks that CPM can write the files and Caddy can read them.

Memory mode: start Caddy with --resume

With File + load you do not need this. In Memory mode, Caddy saves every config it gets from CPM in autosave.json. Start Caddy with --resume to load that file after a restart, so you do not have to click Re-apply.

Caddy on the host (systemd, Debian or Ubuntu package):

sudo systemctl edit caddy
[Service]
ExecStart=
ExecStart=/usr/bin/caddy run --environ --resume --config /etc/caddy/Caddyfile

Caddy in Docker:

services:
  caddy:
    image: caddy:2-alpine
    command: caddy run --resume --config /etc/caddy/Caddyfile --adapter caddyfile
    volumes:
      - caddy_config:/config   # autosave.json is stored here
      - caddy_data:/data

--config is only used the very first time, when there is no autosave.json yet. In Docker, keep the /config volume, or --resume has nothing to load after the container is recreated.

Settings > Global

Section Options
Caddy connection Caddy Admin URL, Admin listen (in Caddy)
Certificates ACME email address, Dry-run (no real certificates), Cloudflare API token
Interface Primary color (a color per menu item, or one fixed color for every page: blue, azure, indigo, purple, pink, red, orange, yellow, lime, green, teal, cyan or inverted), Show favicons, Show Help menu, Check up/down status of hosts, Check interval (seconds)
Logging Logs to Caddy Proxy Manager (for example cpm:9514), Minimum log level
Configuration storage File + load (recommended) or Memory, folders, File server root

Tip: turn on Dry-run while testing. Caddy then uses its own test certificates, so you do not hit Let's Encrypt limits. Turn it off for real use.

Settings > Caddyfile

  • Import Caddyfile: paste an existing Caddyfile. Merge adds and updates items, Replace deletes all hosts, headers and snippets first.
  • Extra global options: extra lines for the global { } block, for example servers { trusted_proxies static private_ranges }.
  • Current Caddyfile: a read-only preview of what CPM generates.