1. 程式人生 > 實用技巧 >Nginx反向代理jellyfin一直失敗的解決方法

Nginx反向代理jellyfin一直失敗的解決方法

jellyfin是emby的替代品,我都嘗試了一下感覺是jellyfin功能沒有emby強大。但是也不是不能用。我就用docker安裝了Jellyfin和emby。使用Nginx反向代理的時候emby比較簡單,一句搞定

jellyfin官方有一個專門的配置文件,但晚的需求和他們文件的有些許差別。我的域名下不只有一個服務,所以給它配置了一個/jellyfin/的路徑,但是它有一個302跳轉一直搞不定,需要一個redirect

    location / {
        # Proxy main Jellyfin traffic
        proxy_pass http://SERVER_IP_ADDRESS:8096/;
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; # Disable buffering when the nginx proxy gets very resource heavy upon streaming proxy_buffering off; }

這麼定義是不行的,需要新增一句proxy_redirect / /jellyfin/就行了

    location / {
        # Proxy main Jellyfin traffic
        proxy_pass http://SERVER_IP_ADDRESS:8096/;
        proxy_redirect / /jellyfin/;
        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; # Disable buffering when the nginx proxy gets very resource heavy upon streaming proxy_buffering off; }

可以看到location的欄位,實際路徑應該是/jellyfin/web/index.html。所以我把/替換成/jellyfin/。location就變成了/jellyfin/web/index.html