{
  "manifest_version": "1",
  "slug": "caddy",
  "title": "Caddy",
  "headline": "Run Caddy as a reverse proxy",
  "description": "Run Caddy 2 on an exe.dev VM: route /api, /grafana and static sites on one port behind exe.dev's HTTPS and login, with file browsing and live reloads.",
  "category": "dev-tools",
  "tags": [
    "caddy",
    "caddyfile",
    "reverse proxy",
    "caddy docker",
    "caddy vps",
    "file server",
    "static site hosting",
    "nginx alternative",
    "traefik alternative"
  ],
  "url": "https://exe.dev/deploy/caddy",
  "markdown_url": "https://exe.dev/deploy/caddy.md",
  "upstream": {
    "website": "https://caddyserver.com",
    "source": "https://github.com/caddyserver/caddy",
    "docs": "https://caddyserver.com/docs/",
    "license": "Apache-2.0"
  },
  "example_vm_name": "my-caddy",
  "time": "10 minutes",
  "stack": [
    {
      "name": "Caddy 2.11",
      "detail": "Caddy's own apt package, as the caddy systemd service; plain HTTP behind exe.dev's HTTPS proxy",
      "port": 8000,
      "data": "/etc/caddy/Caddyfile"
    },
    {
      "name": "Static site",
      "detail": "Any HTML or built front end, served with compression and cache headers",
      "data": "/srv/www"
    },
    {
      "name": "whoami API",
      "detail": "A tiny Go program standing in for your app, as a systemd service",
      "port": 3001
    },
    {
      "name": "File listing",
      "detail": "Caddy's file_server browse, for sharing a folder",
      "data": "/srv/files"
    }
  ],
  "access": [
    {
      "url": "https://my-caddy.exe.xyz/",
      "who": "private",
      "what": "The static site, after exe.dev login"
    },
    {
      "url": "https://my-caddy.exe.xyz/api/whoami",
      "who": "private",
      "what": "The app behind Caddy; scripts get in with a VM token"
    },
    {
      "url": "https://my-caddy.exe.xyz/files/",
      "who": "private",
      "what": "A browsable listing of /srv/files"
    },
    {
      "url": "https://my-caddy.exe.xyz/",
      "who": "public",
      "what": "Optional; with chosen paths still behind login"
    }
  ],
  "delivers": [
    "Caddy 2.11 from Caddy's apt repository on port 8000, behind exe.dev's HTTPS proxy, held to Caddy 2 and started again after a reboot.",
    "One Caddyfile that sends / to a static site in /srv/www, /api/ to an app on port 3001 and /files/ to a browsable folder.",
    "exe.dev's X-Forwarded-* headers trusted and its login headers passed on, so the app sees https and the signed-in user's email.",
    "A check-then-reload routine that keeps the running config when a new one is broken, and JSON access logs with rotation.",
    "A backup of the Caddyfile and both folders, with the restore command."
  ],
  "deployable": true,
  "deploy": {
    "new_vm_url": "https://exe.dev/new?prompt=Set%20up%20Caddy%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe.dev%2Fdeploy%2Fcaddy.md%3Fvia%3Ddeploy%20from%20top%20to%20bottom.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-caddy.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-caddy.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Caddy%202.11%20from%20Caddy%27s%20apt%20repository%20on%20port%208000%2C%20behind%20exe.dev%27s%20HTTPS%20proxy%2C%20held%20to%20Caddy%202%20and%20started%20again%20after%20a%20reboot.%0A-%20One%20Caddyfile%20that%20sends%20%2F%20to%20a%20static%20site%20in%20%2Fsrv%2Fwww%2C%20%2Fapi%2F%20to%20an%20app%20on%20port%203001%20and%20%2Ffiles%2F%20to%20a%20browsable%20folder.%0A-%20exe.dev%27s%20X-Forwarded-%2A%20headers%20trusted%20and%20its%20login%20headers%20passed%20on%2C%20so%20the%20app%20sees%20https%20and%20the%20signed-in%20user%27s%20email.%0A-%20A%20check-then-reload%20routine%20that%20keeps%20the%20running%20config%20when%20a%20new%20one%20is%20broken%2C%20and%20JSON%20access%20logs%20with%20rotation.%0A-%20A%20backup%20of%20the%20Caddyfile%20and%20both%20folders%2C%20with%20the%20restore%20command.%0A%0ARead%20the%20whole%20recipe%2C%20including%20the%20closed%20details.%20For%20initial%20setup%2C%0Afollow%20%22Install%20by%20hand%22%20first%2C%20skipping%20VM%20creation%20and%20SSH%3A%20Caddy%27s%20apt%0Arepository%20and%20pin%2C%20the%20folders%2C%20the%20whoami%20API%2C%20the%20Caddyfile%2C%20and%20the%0Achecks%20at%20the%20end%20of%20it.%20Then%20run%20the%20backup%20command%20in%20%22Back%20up%20and%0Arestore%22%20once.%20The%20walkthrough%20at%20the%20top%20is%20for%20the%20owner%20afterwards.%0ADon%27t%20add%20Grafana%2C%20a%20custom%20domain%20or%20extra%20ports%20unless%20the%20owner%20asks.%0ADon%27t%20make%20the%20VM%20public%20or%20share%20it.%20Never%20put%20a%20hostname%20in%20a%20site%0Aaddress%20without%20http%3A%2F%2F%20in%20front.%20Leave%20the%20admin%20API%20on%20localhost%3A2019.%0AVerify%20caddy%20and%20whoami%20are%20enabled%3B%20do%20not%20reboot.%20Do%20not%20run%20Restore%0Aor%20Update.%20Finish%20with%20the%20VM%27s%20URL%20and%20point%20the%20owner%20to%0Ahttps%3A%2F%2FVMNAME.exe.xyz%2Fapi%2Fwhoami%20and%20the%20%22Add%20your%20own%20app%22%20section.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A",
    "terminal": "curl -fsSL https://exe.dev/deploy/caddy/prompt.txt | ssh exe.dev new --prompt=/dev/stdin",
    "prompt": "Set up Caddy on this VM by following the exe.dev recipe at https://exe.dev/deploy/caddy.md?via=deploy from top to bottom.\n\nThe recipe's example VM name is my-caddy. This VM's name is the output of `hostname`: use it wherever the recipe writes my-caddy. Skip the step that creates the VM; you are on it.\n\nYou are done when all of these are true. Check each one yourself:\n- Caddy 2.11 from Caddy's apt repository on port 8000, behind exe.dev's HTTPS proxy, held to Caddy 2 and started again after a reboot.\n- One Caddyfile that sends / to a static site in /srv/www, /api/ to an app on port 3001 and /files/ to a browsable folder.\n- exe.dev's X-Forwarded-* headers trusted and its login headers passed on, so the app sees https and the signed-in user's email.\n- A check-then-reload routine that keeps the running config when a new one is broken, and JSON access logs with rotation.\n- A backup of the Caddyfile and both folders, with the restore command.\n\nRead the whole recipe, including the closed details. For initial setup,\nfollow \"Install by hand\" first, skipping VM creation and SSH: Caddy's apt\nrepository and pin, the folders, the whoami API, the Caddyfile, and the\nchecks at the end of it. Then run the backup command in \"Back up and\nrestore\" once. The walkthrough at the top is for the owner afterwards.\nDon't add Grafana, a custom domain or extra ports unless the owner asks.\nDon't make the VM public or share it. Never put a hostname in a site\naddress without http:// in front. Leave the admin API on localhost:2019.\nVerify caddy and whoami are enabled; do not reboot. Do not run Restore\nor Update. Finish with the VM's URL and point the owner to\nhttps://VMNAME.exe.xyz/api/whoami and the \"Add your own app\" section.\n\nFinish with the URLs I should open.\n",
    "prompt_url": "https://exe.dev/deploy/caddy/prompt.txt"
  },
  "published": "2026-11-22",
  "updated": "2026-11-22",
  "verified": "2026-11-22",
  "related": [
    "react-vite",
    "go",
    "nodejs",
    "grafana",
    "docker-compose",
    "astro"
  ],
  "alternatives": [
    "nginx",
    "Traefik"
  ]
}
