What's the optimal way to serve multiple static sites via Caddy Docker?

1. The problem I’m having:

I currently have Caddy installed via Docker and have mapped the internal /src directory to a local folder on my system named ‘site’. When I serve static files from a directory within ‘site’, I add a file_server line to my Caddyfile to serve the files from the specified folder, which means I can then access that site by appending the folder name within ‘site’ to the end of my domain.

I have three different folders in the ‘sites’ folder but would now like to host a static site at the root of one of my subdomains: feedr.duckdns.org.

I have the static files for this site in a folder named ‘feedr’ stored in my ‘site’ folder. I’ve added the file_server directive to my Caddy file, but the URL doesn’t work unless I append the folder name (‘feedr’) as a subpath to the subdomain (feedr.duckdns.org/feedr). See the Caddyfile below to see this in action.

How can I point a subdomain to a static file folder within the ‘site’ folder without needing to append that folder name to the end of the link to get it to work? I considering just mapping it to / in my Caddyfile, but I assume that would also give it access to all the static files in my ‘site’ folder, not just ‘feedr’.

2. Error messages and/or full log output:


3. Caddy version:

Caddy v2.6.4

4. How I installed and ran Caddy:

a. System environment:

Docker, docker-compose on Debian

b. Command:


c. Service/unit/compose file:

    image: caddy:2
    container_name: caddy
    restart: unless-stopped
      - 443:443
      - ${APPDATA}/caddy/Caddyfile:/etc/caddy/Caddyfile
      - ${APPDATA}/caddy/site:/srv
      - ${APPDATA}/caddy/data:/data
      - ${APPDATA}/caddy/config:/config
      - caddy

d. My complete Caddy config:

feedr.duckdns.org {

  handle_path /* {
    file_server /feedr/*


5. Links to relevant resources:

You should use the root directive to tell Caddy where to look for files on disk.

Also, make sure to read this article:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.