全網最全的 qBittorrent 報錯 Unauthorized 的解決辦法。(方便搜索:如何為 qBittorrent 設置 Nginx 反向代理、qBittorrent 打不開、qBittorrent 網頁版報錯)
- 確保啟動參數無誤,尤其是配置文件的目錄,必須是 qbittorrent 的父級目錄,不可以到 qbittorrent 這一層。
- 如果你是在外網通過 IP 訪問內網服務器,則需查看 qbittorrent.conf 中,是否設置了 WebUI\HostHeaderValidation=true 參數,如有,請改為 false。
- 如果你是在外網通過域名訪問內網服務器,則第二條同樣適用;但安全起見,建議改為 true 並把值設置為你的域名。
- 如果你並未配置 HTTPS 證書,或未安裝相關組件,則需查看 qbittorrent.conf 中,是否設置了 WebUI\HTTPS\Enabled=ture 參數,如有,請改為 false。
- 如果你設置了 Nginx 反向代理,則需要根據官方 Wiki 設置以下參數(請刪除其他所有參數):
proxy_pass http://127.0.0.1:30000/; # 根據你的 IP 地址和端口號修改 proxy_http_version 1.1; proxy_set_header Host 127.0.0.1:30000; # 根據你的 IP 地址和端口號修改 proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-For $remote_addr; # 以下參數不適用於 qBittorrent!請務必移除(若有) #proxy_set_header X-Forwarded-Proto $scheme; #proxy_set_header X-Real-IP $remote_addr; # 可選,設置后可一次性添加 100M 的種子 #client_max_body_size 100M; # 從 4.2.2 版本起,若你在 qBittorrent 內部設置了 HTTPS,則不需要設置以下參數。否則,必須設置以下參數用以保證 Cookie 的安全性 proxy_cookie_path / "/; Secure";
參考鏈接:
- https://www.cnblogs.com/dabai0030/articles/15976106.html
- https://www.drixn.com/2362.html
- https://blog.csdn.net/weixin_45120915/article/details/114691473
- https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI