搭建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。


更多文章
  • 一起来做贼:Goroutine原理和Work stealing
  • Go语言的defer, panic和recover
  • 再读 Python Language Reference
  • 再读vim help:vim小技巧
  • 设计模式(2)- 深入浅出设计模式 阅读笔记
  • 设计模式(1)- 深入浅出设计模式 阅读笔记
  • Cython! Python和C两个世界的交叉点
  • socketserver 源码阅读与分析
  • functools 源码阅读与分析
  • contextlib代码阅读
  • Collections 源码阅读与分析
  • Redis通信协议阅读
  • 2016年就要结束了,2017年就要开始啦!
  • unittest 源代码阅读
  • APUEv3 - 重读笔记