Black Friday: 40% off for life · BLACKFRIDAY40Claim →
crabsmith Get started
Browse documentation
← All documentation

Static sites

On this page

Serve plain HTML, CSS, and JavaScript—or build Vite, Astro, React, or Vue apps directly on the server—behind Caddy with automatic HTTPS.

Required services

On your server's Services tab, install Caddy. Add Node.js (and pnpm if needed) only if your site needs a build step on deploy.

Create the site

  1. Open your server's Sites tab, click New site, and choose Static.
  2. Enter your domain (or Free domain), pick your repository and branch, and (if your site needs a build step) uncheck Deploy after creating so you can set the output folder first, then click Create site.

By default, Caddy serves files from the repository root. Dotfiles and hidden folders such as .git and .env are automatically blocked from public access.

Single-page apps and build steps

For apps built with Vite, Astro, or similar tools:

  1. Open the site's Settings → General, set Web directory to your build output folder (such as dist or build), and click Save.
  2. If your app uses client-side routing (React Router, Vue Router, etc.), enable Single-page app fallback so unknown paths serve index.html.
  3. Add your build commands to Settings → Deployment and click Save:
sh
npm ci
npm run build

(Using pnpm? Use pnpm install --frozen-lockfile and pnpm run build instead.)

  1. Click Deploy now, then open your domain and test a client-side route to confirm it loads cleanly.

Need custom redirects, cache headers, or an /api reverse proxy? Add them under Settings → Caddy—see Sites.