When serving static files, you may want Caddy to only serve static files, or sometimes you may want Caddy to serve static files and run as a reverse proxy.

Only serve static files

To configure Caddy to only serve static files, use the file_server directive, then set the root directory. The * immediately after root tells Caddy that it should match all requests–without it, Caddy wouldn’t work.

localhost:2015 {
	root * /srv/static-files
	file_server
}