qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.62k stars 4.01k forks source link

qBittorrent Web UI reverse proxy Synology #9519

Open CooleRnax opened 6 years ago

CooleRnax commented 6 years ago

Hello, i have qBittorrent docker container running at 8080 port on Synology NAS. I'm trying to set up reverce proxy. But it doesn't work at all. Can someone tell what i'm missing?

There is a gude for this, but it didn't worked for me. https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI

Result: I even don't see login page.

My setup: https://ibb.co/d5dz6e

CooleRnax commented 6 years ago

Do you have any ideas?

Chocobo1 commented 6 years ago

Try a clean install of the new v4.1.3.

CooleRnax commented 6 years ago

I have tried, still can't even see login page through reverse proxy. I have multiple apps that use reverse proxy, and this is the only one that is totally unreachable.

CooleRnax commented 6 years ago

Still not solved

dextouu commented 6 years ago

if the container is "Linuxserver.io" , if yes, you have misread the page . Assuming it is "linuxserver.io", you have to change the port in the environment variables and in the port section.

CooleRnax commented 6 years ago

Yep container is from linuxserver. Docker ENV: WEBUI_PORT:8080 Web Interface Port: 8080 Everything seems to be correct

CooleRnax commented 6 years ago

and -p 8080:8080

dextouu commented 6 years ago

you have to change the port to something other than 8080, linuxserver the mark on their page. ex: Docker ENV: WEBUI_PORT: 8060 Web Interface Port: 8060: 8060.

dextouu commented 6 years ago

"Due to issues with CSRF and port mapping, should you require to alter the port for the webui you need to change both sides of the -p 8080 switch AND set the WEBUI_PORT variable to the new port.

For example, to set the port to 8090 you need to set -p 8090:8090 and -e WEBUI_PORT=8090

This should alleviate the "white screen" issue.

If you have no webui , check the file /config/qBittorrent/qBittorrent.conf

edit or add the following lines

WebUI\Address=*

WebUI\ServerDomains=*. "

CooleRnax commented 6 years ago

I have tried 8081

-p 8081:8081 -e WEBUI_PORT=8081 WebUI\Address= WebUI\ServerDomains= WebUI\Port=8081 Updated reverse proxy settings too

Direct access to 8081 works, same as before for 8080.

Reverse proxy, doesn't, same as before for 8080.

dextouu commented 6 years ago

the access on the webui works or not in outside, and in mobile version ?

CooleRnax commented 6 years ago

the access on the webui works from everywhere. the access through reverse proxy doesn't work

ghost commented 4 years ago

I have this version qbittorrent installed on dsm 6.2.2-24922 unfortunately does not start http://ssd.dlinkddns.com/pub/synology/qbittorrent/

Lonli-Lokli commented 4 years ago

Same issue with me on Docker & Synology

Lonli-Lokli commented 4 years ago

Ok So I was able to solve it this way:

location = /qbt { return 301 http://$host$request_uri/; } location /qbt/ {
proxy_pass http://localhost:7788/; proxy_http_version 1.1; proxy_set_header X-Forwarded-Host $server_name:$server_port;
proxy_hide_header Referer; proxy_hide_header Origin; proxy_set_header Referer ''; proxy_set_header Origin ''; }

CooleRnax commented 4 years ago

I have tried setting up same in synology gui. But there is no option to hide header. And not sure if empty headers are handled correctly. As a result this setup didn't worked.

image

Lonli-Lokli commented 4 years ago

I actually use direct configuration of nginx instead of Synology's UI. Setup for qbit is here - https://pastebin.com/deF2JWig

FranciscoPombal commented 4 years ago

I recently updated the wiki page: https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI

If you're having trouble, post nginx logs and qbittorrent logs here. Some people have trouble with the "enable host header validation" feature and the way they setup their proxy. I cannot help with synology GUI stuff.

Lonli-Lokli commented 4 years ago

@CooleRnax setup above should work as well, just open it with trailing slash. Also do not forget to clear browser cache.

ghost commented 4 years ago

qbittorrent.log qbitorrent log is empty nginx.log here

2019/12/29 02:24:33 [error] 17003#17003: *4658 open() "/var/services/web/cgi-bin/config.exp" failed (2: No such file or directory), client: 169.xxx.xxx.xx, server: , request: "GET /cgi-bin/config.exp HTTP/1.1", host: "185.xx.xx.xxx" 2019/12/29 02:39:34 [notice] 16045#16045: signal process started 2019/12/29 02:39:34 [error] 16045#16045: open() "/run/nginx.pid" failed (2: No such file or directory) 2019/12/29 02:39:34 [notice] 16063#16063: signal process started 2019/12/29 02:39:34 [error] 16063#16063: open() "/run/nginx.pid" failed (2: No such file or directory) 2019/12/29 18:27:59 [notice] 14212#14212: signal process started 2019/12/29 18:28:06 [notice] 15617#15617: signal process started

this version does not start qBittorrent_x64-6.1_4.1.9.1.spk I have created this file mediaProxy.conf has not changed anything

kapsh commented 1 month ago

DSM 7.2 allows to create reverse proxy using standard synology apps only. Tested with roughly this compose:

services:
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:5.0.0
    environment:
      WEBUI_PORT: 4000    
    ports:
      # keep both sides of the -p and the WEBUI_PORT in sync
      # https://docs.linuxserver.io/images/docker-qbittorrent/#webui_port-variable
      - 4000:4000

Assuming qbittorent will listen on example.com:4000 there are 2.5-3 ways to proxy it (counting some quirks).

If Container Manager and Web Station are installed: when creating container or project check "setup web portal" for http port 4000. Web station window opens, asks to configure portal to the "service" (exposed listening port of this container in their lingo). Choose: a. name based and enter subdomain, e.g. torrents.example.com, keep ports 80 or 443 - works b. alias based, e.g. example.com/torrents (80/443 cannot be changed here, it seems to follow "default portal" web station setting) - works c. port based, e.g. listen on 8443 - kinda works

Without Web Station hostname-based portal (works) can be created in Control panel / Login portal / Reverse proxy which is pictured in the opening post. Mostly the same as a) and also allows to add custom nginx headers which are not needed in this case.

* Ports different from that in qbittorent's settings will show "unauthorized" page with "Invalid Host header, port mismatch" error in logs, same as differing listening and exposed ports. They will work if webui option "Enable Host header validation" is unchecked. I do not know security implications of that so cannot recommend disabling it.