# /etc/nginx/sites-available/jellyfin # WebSocket upgrade helper (for Jellyfin) map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; server_name nik4nao.home.arpa; # ---- Convenience redirects ---- location = / { return 302 /admin/; } # land on Pi-hole admin by default location = /pihole { return 302 /admin/; } # /pihole -> /admin/ location /pihole/ { return 301 /admin/; } # keep only /admin/ path # ---- Jellyfin at /jellyfin/ ---- location = /jellyfin { return 302 /jellyfin/; } # enforce trailing slash location /jellyfin/ { proxy_pass http://jellyfin_upstream/; # uses upstream (or use the raw URL) include snippets/proxy-common.conf; # Jellyfin behind subpath specifics proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Prefix /jellyfin; # (Optional) if you see odd redirects, uncomment: # proxy_redirect off; } # ---- Pi-hole admin at /admin/ ---- # Pi-hole’s UI lives under /admin/, so keep the trailing slash in proxy_pass. location /admin/ { proxy_pass http://pihole_upstream/admin/; include snippets/proxy-common.conf; proxy_set_header X-Forwarded-Host $host; } # Pi-hole API (some UI calls hit /api/) location /api/ { proxy_pass http://pihole_upstream/api/; include snippets/proxy-common.conf; proxy_set_header X-Forwarded-Host $host; } # redirect /watch-party -> /watch-party/ location = /watch-party { return 302 /watch-party/; } # proxy ONLY /watch-party/*, keeping the prefix location ^~ /watch-party/ { proxy_pass http://watchparty_upstream; # ← no trailing slash (preserve /watch-party) include snippets/proxy-common.conf; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Prefix /watch-party; # For Vite HMR / websockets proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; # Uncomment if you see odd redirects # proxy_redirect off; } }