Caddy via Docker (Windows) - VAR

1. The problem I’m having:

All I want in the world is to set Caddy up to support my Jellyfin. I’m doing the install and everything through Docker, and I think I’m 80% there. I have Caddy installed, Jellyfin installed, website domain registered, etc. But. When I go to my domain, I get the crooked 'Hello! Your web server is working, now… etc" Caddy screen telling me to ‘upload your site’s files to /var/www/html,’ and honestly I’m just stuck.

2. Error messages and/or full log output:

There’s no direct error message, it appears to be running. The issue comes when trying to access my site.

3. Caddy version:

2.7.6

4. How I installed and ran Caddy:

I installed Caddy through Docker-Compose.

a. System environment:

Docker via Windows.

b. Command:

So as far as I can tell, Caddy is running- it just isn’t actually connecting to my site fully. It isn’t an issue of typing in the wrong command (as far as I know) but more an issue with configuration. I’ve compared five different guides, but often guides are for Linux or don’t specify what I’m having an issue with.
In the guides (for example the one linked below), the tutorial typically instructs you to create different folders or directories. However, Caddy also says on the ‘Your Web Server is Working’ page to upload files to /var/www/html.
I know this is probably a silly question, but I’m brand-new to coding and programming and everything like this-- do I create a var folder, a www folder, an html folder? I don’t understand why the tutorial didn’t tell me that-- unless it exists somewhere that I don’t know of? Additionally, the Caddy Web Server page states to ‘upload your site files’ to that location. What site files? It’s Jellyfin, it’s another service.
I’m so sorry, I’m sure this is so simple, but I just do not understand what I’m missing and I have twenty tabs open but haven’t found a single guide or forum that addressed this (for me) blind spot. I imagine that once I fix whatever this is with the /var thing, then my website will load correctly, I just don’t know how to get to that.

c. Service/unit/compose file:

Docker

d. My complete Caddy config:

DOMAINNAME {
    root * /wdata
    file_server
	encode gzip
	php_fastcgi unix//run/php/php-version-fpm.sock
	file_server
}
reverse_proxy other-container:8080

d. My docker-compose yml:

version: '2.24.5-desktop.1'

name: caddy

services:
  caddy:
    container_name: caddy
    image: caddy
    restart: always
    ports:
      - '80:80'
      - '443:443'
    volumes:
      - caddy-config:/config
      - caddy-data:/data
      - ./Caddyfile:/etc/docker-caddy/Caddyfile
      - ./index.html:/docker-caddy/wdata/index.html

volumes:
  caddy-config:
  caddy-data:

5. Links to relevant resources:

This is the guide I’ve been following most closely, although I used another to set Caddy up via Docker-compose:

This is the wrong path. You’re mounting your Caddyfile to the wrong location inside your container. It needs to be /etc/caddy/Caddyfile.

That’s why you’re seeing the default welcome page, you’re not actually overwriting the default Caddyfile with your own.

This looks wrong, reverse_proxy must go within a site block. Right now reverse_proxy is outside your site block.

Are you also running Jellyfin in Docker? If not, then I recommend you run Caddy natively on windows instead of in Docker, it’ll be easier to proxy to Jellyfin that way.

Also you didn’t mention having a PHP site to serve, are you sure you want php_fastcgi? You shouldn’t just copy-paste any Caddy config you see, you should think about what you need.

Hello! So I’m still a little lost. My path with all my caddy files is:

C:\Program Files\Docker\Docker\docker-caddy
Within the docker-caddy folder are folders: cache, config, data, index.html, sites-enabled, wdata; and files: Caddyfile, docker-compose.yml.

I don’t have a folder just titled ‘caddy’ to contain my Caddyfile, and when I tried making one and moving the file into it, after altering the paths to reflect the new folder, the entire container wouldn’t run and gave an error message that it couldn’t find the specified Caddyfile path.

I did move the reverse_proxy to be inside the site block, now in the line above my }, and removed the line for php. (I am running Jellyfin within a Docker container as well, yeah.)

Now when I go to my domain, the browser gives me an error page and says

What do you mean “all my caddy files”? You should only have a single file called Caddyfile.

You need to mount that file inside of the container at exactly /etc/caddy/Caddyfile, which is where Caddy looks for by default.

Read Keep Caddy Running — Caddy Documentation to see our recommended Docker Compose setup. Compare it with what you currently have.

Don’t use old unofficial guides, use the official docs. Guides like the one you linked earlier almost never get updated, so they fall behind and there’s no guarantee that they’re correct.

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