Skip to content

Instantly share code, notes, and snippets.

@oddstr13
Created May 16, 2019 18:37
Show Gist options
  • Save oddstr13/6384460ad92bfcef8bf56203e20c345d to your computer and use it in GitHub Desktop.
Save oddstr13/6384460ad92bfcef8bf56203e20c345d to your computer and use it in GitHub Desktop.
Jellyfin on subdirectory: nginx config
# Jellyfin on domain sub path.
# I have not yet set up SSL (https) on my setup.
# Replace "media" here with the host running Jellyfin
# "localhost" or "127.0.0.1" if it is running on this machine.
upstream jellyfin {
server media:8096;
}
upstream ombi {
server alvis:3579;
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
listen [::]:80;
server_name media.local;
server_name media;
root /srv/http/media;
index index.html;
location / {
try_files $uri $uri/ =404;
}
# Redirect requests from /jellyfin to /jellyfin/
location /jellyfin {
return 302 /jellyfin/;
}
# The / at the end is significant!
# It makes nginx strip off /jellyfin/ before passing on the request.
location /jellyfin/ {
# Proxy main Jellyfin traffic
proxy_pass http://jellyfin/;
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}
# I've also got ombi running under the same domain.
# Comment out this, and the upstream block above to disable.
location /ombi/ {
proxy_pass http://ombi;
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
# proxy_set_header X-Forwarded-Ssl on;
proxy_read_timeout 90;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment