跳转至

在 Fedora Cloud 上使用 nginx 反向代理安装 qbittorrent

文档时效性说明

本文为早期笔记,可能存在版本过时、命令失效、链接失效、最佳实践变化等问题。请以官方最新文档为准。

原英文标题:Install qbittorrent with nginx reverse proxy on Fedora Cloud

1. 安装并启动 qbittorrent

通过 yum 安装

yum install qbittorrent
yum install qbittorrent-nox

运行 qbittorrent-nox

qbittorrent-nox

添加用户 qbtuser

useradd qbtuser

qbittorrent-nox 添加到 systemctl

nano /usr/lib/systemd/system/qbittorrent.service
[Unit]
Description=qbittorrent torrent server

[Service]
User=qbtuser   
ExecStart=/usr/bin/qbittorrent-nox --webui-port=8080
Restart=on-abort

[Install]
WantedBy=multi-user.target

重新加载 systemctl

systemctl daemon-reload

systemctl 中启用 qbittorrent

systemctl enable qbittorrent --now

2. 添加 Nginx 反向代理

编辑 /etc/nginx/default.d/qbittorrent.conf,添加

1
2
3
4
5
6
7
8
9
location /qbt/ {
    proxy_pass              http://localhost:8080/;
    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                  '';
    add_header              X-Frame-Options         "SAMEORIGIN";
}

并记得检查

include default.d/*.conf;

是否存在于你的 nginx.conf

测试 Nginx 配置

nginx -t

并重启 Nginx

systemctl restart nginx

qbittorrent 的默认用户名和密码是 adminadminadmin


3. 原文(English)

4. Install and start qbittorrent

Install via yum

yum install qbittorrent
yum install qbittorrent-nox

Run qbittorrent-nox

qbittorrent-nox

Add user qbtuser

useradd qbtuser

Add qbittorrent-nox to systemctl

nano /usr/lib/systemd/system/qbittorrent.service
[Unit]
Description=qbittorrent torrent server

[Service]
User=qbtuser   
ExecStart=/usr/bin/qbittorrent-nox --webui-port=8080
Restart=on-abort

[Install]
WantedBy=multi-user.target

Reload systemctl

systemctl daemon-reload

Enable qbittorrent in systemctl

systemctl enable qbittorrent --now

5. Add Nginx reverse proxy

Edit /etc/nginx/default.d/qbittorrent.conf, add

1
2
3
4
5
6
7
8
9
location /qbt/ {
    proxy_pass              http://localhost:8080/;
    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                  '';
    add_header              X-Frame-Options         "SAMEORIGIN";
}

And remember to check

include default.d/*.conf;

exist in your nginx.conf

Test Nginx config

nginx -t

and restart Nginx

systemctl restart nginx

the default username and password for qbittorrent isadmin and adminadmin