前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >在服务器上使用Simple Torrent作为BT离线下载程序

在服务器上使用Simple Torrent作为BT离线下载程序

作者头像
用户1316967
发布2022-01-18 17:20:43
1.4K0
发布2022-01-18 17:20:43
举报
文章被收录于专栏:IF奇思社

Simple Torrent 是基于 Cloud Torrent 二开的应用程序,可以配置在服务器中作为远程下载器使用。搭配自身的 donecmd 功能可以调用外部命令实现下载完成后自动上传到 Onedrive 等网盘中。同时还具有 BT 加密下载、种子订阅等功能。

安装 Simple Torrent

在控制台执行

代码语言:javascript
复制
$ bash <(wget -qO- https://raw.githubusercontent.com/boypt/simple-torrent/master/scripts/quickinstall.sh)

即可完成安装,服务将运行在ip:3000端口上

管理 Simple Torrent

命令

代码语言:javascript
复制
$ systemctl start cloud-torrent      #启动程序
$ systemctl restart cloud-torrent    #重启程序
$ systemctl stop cloud-torrent       #停止程序
$ systemctl status cloud-torrent     #查看状态

验证相关

在程序更新后可能会出现初始验证失效的情况,可以在/etc/systemd/system/cloud-torrent.service文件中修改

代码语言:javascript
复制
[Unit]
Description=Cloud torrent download manager
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=~
Environment=AUTH=user:ctorrent    #验证内容,用户名:密码
Environment=PORT=3000
ExecStart=/usr/local/bin/cloud-torrent -c ./cloud-torrent.json --host 0.0.0.0 --disable-log-time
Restart=always
RestartPreventExitStatus=42
RestartSec=

[Install]
WantedBy=multi-user.target

修改完成后执行以下命令

代码语言:javascript
复制
$ systemctl daemon-reload
$ systemctl restart cloud-torrent

使用 Nginx 代理前端应用

在 Nginx 配置文件中写入以下内容

代码语言:javascript
复制
location / {
    proxy_pass http://127.0.0.1:3000;
}

location /sync {
    proxy_pass http://127.0.0.1:3000;
    proxy_set_header Connection '';
    proxy_http_version 1.1;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
}

完整的 conf 配置文件如下

代码语言:javascript
复制
server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  ssl_certificate #;
  ssl_certificate_key #;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EEC$
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_buffer_size 1400;
  add_header Strict-Transport-Security max-age=15768000;
  ssl_stapling on;
  ssl_stapling_verify on;
  server_name #;
  if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
  location / {
        proxy_pass http://127.0.0.1:3000;
  }
  location /sync {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
  }
}

调用外部指令(配置自动上传)

创建一个调用脚本,up.sh,以下命令适用于 Rclone 挂载的 Onedrive 云盘

代码语言:javascript
复制
#!/bin/bash
if [[ ${CLD_TYPE} == "torrent" ]]; then
eval rclone move \'"${CLD_DIR}/${CLD_PATH}"\' "rc:update";  #此处的"rc:update"可按照rclone move命令自行修改远程目录
fi

给与脚本执行权限

代码语言:javascript
复制
$ chmod +x up.sh

配置 Simple Torrent 调用外部指令,修改配置文件cloud-torrent.json

代码语言:javascript
复制
#外部指令地址
"donecmd": "/root/up.sh",    #填写刚才配置的脚本地址

重启服务完成设置

代码语言:javascript
复制
$ systemctl restart cloud-torrent
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-02-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装 Simple Torrent
    • 管理 Simple Torrent
      • 验证相关
        • 使用 Nginx 代理前端应用
          • 调用外部指令(配置自动上传)
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档