271 words
1 minutes
Snippet: Install Docker and Caddy with a Caddyfile Example

Snippet: Install Docker and Caddy with a Caddyfile Example#

Install Docker#

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker "$USER"
newgrp docker
docker --version

Install Caddy#

# Install Caddy
sudo apt install caddy

# Enable Caddy to start at boot
sudo systemctl enable caddy

# Edit the Caddyfile
sudo nano /etc/caddy/Caddyfile

# Restart Caddy to apply the changes
sudo systemctl restart caddy

Example Caddyfile:

# Ports
#   -  : fuwari            blog.juyung.com
#   -  : devscard           job.juyung.com
#  3003: forgejo            git.juyung.com
#  4004: misskey         social.juyung.com
#  5056: yamtrack          play.juyung.com
#  6342: photoprism      photos.juyung.com
#  7780: homarr             www.juyung.com
#  8082: mailcow           mail.juyung.com
#  8442: linkstack            m.juyung.com
#  9011: umami            radar.juyung.com
#  9022: beszel          system.juyung.com
#  9044: uptime-kuma     status.juyung.com
#  9055: filepizza     transfer.juyung.com
#  9066: opengist          code.juyung.com


juyung.com {
  encode zstd gzip

  @mobile header_regexp User-Agent "(?i)(mobile|android|iphone|ipad|ipod|windows phone)"
  redir @mobile https://m.{host}{uri} 301

  route / {
    redir https://www.{host}{uri} 301
  }

  root * /var/www/html
  file_server
}

*.juyung.com {
  encode zstd gzip

  header {
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "SAMEORIGIN"
    Referrer-Policy "no-referrer"
  }
}

go.juyung.com {
  route /email {
    redir mailto:****@****.com
  }
}

blog.juyung.com {
  root * /var/www/html/blog
  file_server
}

job.juyung.com {
  root * /var/www/html/job
  file_server
}

git.juyung.com {
  reverse_proxy localhost:3003
}

social.juyung.com {
  reverse_proxy localhost:4004
}

play.juyung.com {
  reverse_proxy localhost:5056
}

photos.juyung.com {
  reverse_proxy localhost:6342
  rewrite / /s/gallery/album
}

www.juyung.com {
  reverse_proxy localhost:7780
  rewrite / /boards/default
}

mail.juyung.com {
  reverse_proxy localhost:8082
  respond 404
}

m.juyung.com {
  reverse_proxy localhost:8442 {
    transport http {
      tls_insecure_skip_verify
    }
  }
}

radar.juyung.com {
  reverse_proxy localhost:9011
}

system.juyung.com {
  reverse_proxy localhost:9022
}

status.juyung.com {
  reverse_proxy localhost:9044
}

file.juyung.com {
  basicauth / {
    user ****
  }
  reverse_proxy localhost:9055
}

code.juyung.com {
  reverse_proxy localhost:9066
}
Snippet: Install Docker and Caddy with a Caddyfile Example
https://blog.juyung.com/posts/en/2026/10/20-2/
Author
Jay Juyung
Published at
2026-10-20
License
CC BY