Setup caddy from docker compose

1. Output of caddy version:


2. How I run Caddy:

docker-compose up -d

a. System environment:

Ubuntu 20.04.4 LTS docker compose

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: '3'

    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: always
      WEBSOCKET_ENABLED: "true"  # Enable WebSocket notifications.
      SIGNUPS_ALLOWED: "false"
      - ./vw-data:/data

    image: caddy:2
    container_name: caddy
    restart: always
      - 80:80  # Needed for the ACME HTTP-01 challenge.
      - 443:443
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - ./caddy-config:/config
      - ./caddy-data:/data
      - ./test_code:/wdata
      DOMAIN: ""  
      EMAIL: ""                 
      LOG_FILE: "/data/access.log"

d. My complete Caddy config: { 
  root * wdata 
  tls {$EMAIL}
} {
  log {
    level INFO
    output file {$LOG_FILE} {
      roll_size 10MB
      roll_keep 10

  tls {$EMAIL}
  encode gzip

  # Notifications redirected to the WebSocket server
  reverse_proxy /notifications/hub vaultwarden:3012

  # Proxy everything else to Rocket
  reverse_proxy vaultwarden:80 {
       # Send the true remote IP to Rocket, so that vaultwarden can put this in the
       # log, so that fail2ban can ban the correct IP.
       header_up X-Real-IP {remote_host}

3. The problem I’m having:

Hello! I apologize for my bad English and stupid questions. I’ve searched the forum but couldn’t find answers to my questions. I have a small VPS server running vault warden and using caddy as the recommended web server for the web interface. Everything started up and works great. But now I want to add a static site, I’m getting a 404 error when I try to add a single site, on the path “test_code” is caddy.html file, but I still get a 404 error. I can’t figure out how to solve this problem.

4. Error messages and/or full log output:

browser return 404 

5. What I already tried:

I don’t know what to do in this case…

6. Links to relevant resources:

Hi :wave:

Try adding the absolute path in your Caddyfile

Instead of


  root * /wdata

Sorry it is so simple, why didn’t I figure it out? thank you

1 Like

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