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


更多文章
  • 读《格鲁夫给经理人的第一课》
  • 读《打开心智》
  • 为什么要把复杂的联表操作拆成多个单表查询?
  • 红包系统的设计
  • 2022年终总结
  • MySQL Index Condition Pushdown Optimization
  • Go mod 简明教程
  • OpenWRT 使用 Android/iOS USB 网络
  • 搭建旁路由
  • Golang gRPC 错误处理
  • 编写可维护的单元测试代码
  • OAuth 2 详解(六):Authorization Code Flow with PKCE
  • OAuth 2 详解(五):Device Authorization Flow
  • OAuth 2 详解(四):Client Credentials Flow
  • OAuth 2 详解(三):Resource Owner Password Credentials Grant