我安装了qBittorrent泊坞窗。我在路由器上进行了转发;然后使用nginx的反向代理;最后,码头工人端口映射。

连锁店是:

[Port forwarding on Router]:
<WAN's IP>:44383 --> 192.168.10.254:44383
[Nginx]:
44383 --> 44373
[qBittorrent Docker]:
44373 --> 8083


Nextcloud码头工人以相同的方式完成工作,它为我工作。但是它对于qBittorrent失败了。

这是docker-compose.yml:

admin@pve:~/docker-qbittorrent$ cat docker-compose.yml
version: "2"
services:
  qbittorrent:
    image: linuxserver/qbittorrent
    container_name: qbittorrent
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai
      - UMASK_SET=022
      - WEBUI_PORT=8073
      #- WEBUI_PORT=8080
      #- DOMAIN=https://example.com

    volumes:
      - ./config:/config
      - ./downloads:/downloads
    ports:
      - "6881:6881/tcp"
      - "6881:6881/udp"
      - "44373:8073"
      #- "44373:8080"
    restart: unless-stopped


和qbittorrent.conf:

admin@pve:~/docker-qbittorrent$ cat config/qBittorrent/qBittorrent.conf
[AutoRun]
enabled=false
program=

[LegalNotice]
Accepted=true

[Network]
Cookies=@Invalid()

[Preferences]
Connection\PortRangeMin=6881
Connection\UPnP=false
Downloads\SavePath=/downloads/
Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\0)
Downloads\TempPath=/downloads/incomplete/
WebUI\Address=*
WebUI\Port=8073
WebUI\ServerDomains=*


这是nginx配置文件:

admin@pve:/etc/nginx/sites-available$ cat ../sites-enabled/docker-qbittorrent
server {
  listen 8083;
  server_name example.com;
#  return 301 https://$host$request_uri;
}
server {
#    listen 44383 ssl http2;
    listen 44383;
    server_name example.com;
    ssl on;
    ssl_certificate /etc/ssl/certs/example.com.pem;
    ssl_certificate_key /etc/ssl/certs/example.com.key;
    location / {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:44373;
        proxy_set_header Host $http_host;
    }
}


码头工人似乎工作正常:

admin@pve:~/docker-qbittorrent$ docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS                 PORTS                                                                               NAMES
8e7b4c80c1ea        linuxserver/qbittorrent    "/init"                  3 hours ago         Up 3 hours             0.0.0.0:6881->6881/tcp, 0.0.0.0:6881->6881/udp, 8080/tcp, 0.0.0.0:44373->8073/tcp   qbittorrent


但是我无法访问webUI:

admin@pve:~/docker-qbittorrent$ curl localhost:6881
curl: (52) Empty reply from server
admin@pve:~/docker-qbittorrent$ curl localhost:44373
<No output here>
admin@pve:~/docker-qbittorrent$ curl https://example.com:44383
<No output here>



我使用chrome浏览器得到了一个空白网页。

但是在docker内部,webUI似乎还可以:

admin@pve:~/docker-qbittorrent$ docker exec -ti qbittorrent bash
root@8e7b4c80c1ea:/# curl localhost:8073
<!DOCTYPE html>
...
</html>


有人可以帮忙吗?谢谢!

最佳答案

WEBUI_PORT Variable


  由于CSRF和端口映射的问题,如果您需要更改webui的端口,则需要更改-p 8080开关的两侧并将WEBUI_PORT变量设置为新端口。
  例如,要将端口设置为8090,需要设置-p 8090:8090和-e WEBUI_PORT = 8090

08-07 19:24