zoukankan      html  css  js  c++  java
  • (四)下载利器aria2

    既然较私有云,那么离线下载这最起码的功能应该得要支持吧,这时候发现了aria2

    这玩意简直是大杀器,支持http也支持bt下载,性能不弱,速度也不逊色于迅雷,缺点就是没界面。

    没界面没关系,还有万能的基友们,带上AriaNg就万事俱备了。

    首先,安装aira2,老配方:

    偷懒的同学可以直接选用前4个镜像,我喜欢单独装,因为这样就可以自己diy了,所以选择了opengg/aria2。

    镜像下载下来后,只需配置两个参数:

    1. 配置文件,默认存放在/config

    2. 下载目录,默认存放在/downloads

    3. 默认端口为6800  

    因此使用docker-compose启动脚本为:

    version: '3.1'
    
    services:
    
      aria2:
        image: opengg/aria2
        restart: always
        volumes:
          - /data/aria2:/config
          - /working/3.download/tmp:/downloads

    我这边没有把端口映射出来,配置完成后启动镜像,使用nginx代理:

    location /aria2/ {
      proxy_pass http://aria2:6800/;
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    启动成功后,可以看下映射出来的config文件夹下的aria2.conf文件,主要关注我标红的几个属性,其他属性可以后续在进行玩耍。

    save-session=/config/aria2.session
    input-file=/config/aria2.session
    save-session-interval=60
    
    dir=/downloads
    
    file-allocation=prealloc
    disk-cache=128M
    
    enable-rpc=true
    rpc-listen-port=6800
    rpc-allow-origin-all=true
    rpc-listen-all=true
    
    rpc-secret=*******
    
    auto-file-renaming=false
    
    max-connection-per-server=16
    min-split-size=1M
    split=16

    接着就得部署界面了,拉取镜像:

    同样是使用纯净的镜像:leonismoe/ariang 

    ui简单,默认80端口,无需其他配置:

    version: '3.1'
    
    services:
    
     
      ariang:
        image: leonismoe/ariang
        restart: always

    配置完成启动镜像,加进nginx代理:

    location /ariang/ {
            proxy_pass http://ariang:80/;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

    重启nginx,访问ariang,进行aria2配置,打开后的页面是这样的:

     乍一看左下角Aria2未连接,点开F12,会发现有个请求一直在重复,状态一直是pending,最后变成fialed

    原因是Request URL:https://**********:6800/jsonrpc,地址明显有误,没有放到代理里面。

    此时,先进行AriaNg设置,把Aria2配置正确,表格修改后会自动保存,此时刷新页面,既可以看到绿色的状态已连接

    到达这里就已经可以进行下载了,如果要修改aria2的配置就可以在页面上进行愉快的配置了。

  • 相关阅读:
    BestCoder Round #86 1001
    Codeforces Round #365 (Div. 2) B
    Codeforces Round #365 (Div. 2) A
    Codeforces Round #129 (Div. 2) C
    Codeforces Round #129 (Div. 2) B
    Android.mk 文件语法详解
    RDS和ROS使用小结
    电力企业计量生产需求系统解决方案
    android 修改framework下资源文件后如何编译
    USB port 如何识别不同的Charger类型
  • 原文地址:https://www.cnblogs.com/zqyx/p/12670442.html
Copyright © 2011-2022 走看看