Prerequisites
Before you begin, make sure you have Caddy installed. See the installation guide if you haven’t installed Caddy yet. Verify your installation:Serve a Static Site
1
Create a simple HTML file
Create an
index.html file in a new directory:2
Start Caddy
Run Caddy with the file server:Your site is now available at
http://localhost:2015Use a Caddyfile
For more control, create aCaddyfile in your site directory:
Caddy automatically looks for a
Caddyfile in the current directory when you run caddy run without specifying a config.Enable Automatic HTTPS
To enable automatic HTTPS for a real domain:Reverse Proxy
Here’s how to proxy requests to a backend application:With Path-Based Routing
Common Caddyfile Patterns
Static Site with Compression
SPA (Single Page Application)
Reverse Proxy with Custom Headers
Multiple Sites
Production Operations
1
Start Caddy as a service
Use
caddy start to run in the background:2
Check status
3
Reload configuration
After changing your Caddyfile:This performs a zero-downtime reload.
4
Stop Caddy
Using the Admin API
Caddy’s admin API runs onlocalhost:2019 by default.
Get current config
Load a new config
Next Steps
Core Concepts
Learn about Caddy’s architecture and module system
Caddyfile
Master the Caddyfile configuration format
Reverse Proxy
Deep dive into reverse proxy configuration
CLI Reference
Explore all Caddy commands