Advertisement
Guest User

Jellyfin Reverse Proxy using Caddy

a guest
May 12th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.79 KB | Source Code | 0 0
  1. # place this file in it's own folder and in that folder execute 'docker compose up -d' without the quotes as root to set up everything. You can tear it all down (stop and delete the containers) with 'docker compose down'
  2.  
  3. volumes:
  4.   jellyfin:
  5.   caddy-data:
  6.   caddy-config:
  7.   caddy-logs:
  8. # run 'docker create network internal; docker create network web' (without the quotes) before executing this or it will complain that the networks don't exist!
  9.  
  10. networks:
  11.   web:
  12.     external: true
  13.   internal:
  14.     external: true
  15.  
  16. services:
  17.   caddy:
  18.     image: homeall/caddy-reverse-proxy-cloudflare:latest
  19.     container_name: caddy
  20.     ports:
  21.      - your.servers.LAN.ip:80:80
  22.       - your.servers.LAN.ip:443:443
  23.     environment:
  24.      - TZ=America/New_York #change to your timezone
  25.       - CLOUDFLARE_EMAIL=Your_Cloudflare_Account_Name
  26.       - CLOUDFLARE_API_TOKEN=Your_API_Token
  27.       - ACME_TRUE=true
  28.     labels:
  29.       caddy.log.format: console
  30.       caddy.log.output: stdout
  31.       caddy.log.level: info
  32.       #caddy.acme_ca: https://acme-staging-v02.api.letsencrypt.org/directory #uncomment for testing, it won't generate a valid SSL cert but it will let you know that everything is working correctly (it acts like it's attempting to generate a valid cert), if you don't use the 'staging' environment while testing it will rate limit you after a certain amount of attempts and block you for like 24-48 hours, invalidating your tests and make you bash your head against the wall while trying to figure out why it won't work correctly
  33.       #if it refuses to issue certs stating that it can't find the zone for your domain. make sure /etc/resolv.conf is set to 1.1.1.1 (or your authoritative DNS server)
  34.     networks:
  35.      - web
  36.     restart: always
  37.     cap_add:
  38.      - NET_ADMIN
  39.     volumes:
  40.      - /var/run/docker.sock:/var/run/docker.sock
  41.       - caddy-data:/data/caddy
  42.       - caddy-config:/config/caddy
  43.       - caddy-logs:/logs
  44.  
  45.   jellyfin:
  46.     image: jellyfin/jellyfin
  47.     container_name: jellyfin
  48.     user: 1000:1000 (this is probably a different UID for you, check your UID with the 'id <username>' CLI command replacing  <username> with your username
  49.     networks:
  50.     - internal
  51.      - web
  52.     ports:
  53.      - your.servers.lan.ip:8096:8096
  54.     labels:
  55.       caddy: jellyfin.yourdomain.com
  56.       caddy.reverse_proxy: your.servers.LAN.ip:8096
  57.       caddy.tls.dns: cloudflare Paste_Your_API_Key_here #don't delete the word cloudflare!
  58.       caddy.log.output: file /logs/jellyfin.log
  59.       caddy.log.level: info #debug can also be useful
  60.     volumes:
  61.      - jellyfin:/config
  62.       - /path/to/media/on/your/server:/media
  63.     restart: always
  64.     environment:
  65.      - JELLYFIN_PublishedServerUrl=https://jellyfin.yourdomain.com
  66.       - HEALTHCHECK_URL=http://your.servers.LAN.ip:8096/health
  67.  
Tags: jellyfin caddy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement