搭建aria2服务器

首先安装:

$ sudo pacman  -S aria2

然后创建如下systemd配置(放到 /etc/systemd/system/aria2.service):

[Unit]
Description=Aria2 Service
After=network.target

[Service]
User=http
ExecStart=/usr/bin/aria2c --enable-rpc --rpc-listen-all --rpc-allow-origin-all --save-session /etc/aria2/session.lock --input-file /etc/aria2/session.lock --conf-path=/etc/aria2/aria2.conf

[Install]
WantedBy=default.target

创建aria2配置文件:

$ sudo mkdir /etc/aria2
$ sudo touch /etc/aria2/session.lock
$ sudo vim /etc/aria2/aria2.conf

把如下配置贴进去:

continue # 断点续传
dir=/data/download  # 下载路径,注意要配置好写入权限
file-allocation=none  # 是否prealloc,我选择不
log-level=info # 日志等级
max-connection-per-server=4 # 每个服务器4个连接
max-concurrent-downloads=3 # 最多3个并发下载
enable-http-pipelining=true # 是否开启pipelining
rpc-secret=<token> # 这里要换成你自己的token

然后启动aria2:sudo systemctl start aria2

可以装一个前端,我是用的是 aria2-webui

$ cd /data/html
$ git clone [email protected]:ziahamza/webui-aria2.git aria2

Nginx加个配置:

        location /dl {
            alias /data/html/aria2/docs;
            index  index.html index.htm;
        }

        location /jsonrpc {
            proxy_pass http://127.0.0.1:6800;
        }

就可以访问 http://127.0.0.1/dl 来下载文件了,当然,访问到网页之后记得填上面配置文件里的token。


更多文章
  • 动态规划民科教程
  • Golang 分布式异步任务队列 Machinery 教程
  • 使用geohash完成地理距离计算
  • 2018年就要到了,这一年都做了什么呢?
  • 算法导论阅读笔记 --- 排序算法
  • 短链系统的实现
  • Git HTTPS 如何保存密码
  • 程序员修炼之道 阅读笔记
  • Python开发实践经验
  • Golang实现平滑重启(优雅重启)
  • traefik 教程
  • Web开发系列(十):事务和锁
  • Web开发系列(十一):数据库扩展
  • Nginx作为TCP/UDP的负载均衡
  • Web开发简介系列