利用Centos7搭建aria2下载器

环境:一台装了Centos7 x64 的美国VPS

一  安装aria2

1 安装epel源

rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

2 安装Aria2

yum install aria2 -y

3 生成配置文件

mkdir /etc/aria2/
vi /etc/aria2/aria2.conf

配置内容

#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
dir=/var/www/html/downloads
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用
#disk-cache=0
#另一种Linux文件缓存方式
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
file-allocation=prealloc

4 测试启动 

aria2c --conf-path=/etc/aria2/aria2.conf

5 无错误启动

aria2c --conf-path=/etc/aria2/aria2.conf -D

6 开启6800端口

firewall-cmd --zone=public --add-port=6800/tcp --permanent
systemctl restart firewalld.service

7 利用webUI控制下载

网址:http://aria2c.com/

二 配置httpsd服务器

1 安装httpd

 yum  -y  install  httpd

2 开启目录

这步是为了利用httpd将已经下载好的文件传到本地

将配置文件 /etc/httpd/conf.d/welcome.conf

<LocationMatch "^/+$">

    Options +Indexes
    ErrorDocument 403 /.noindex.html
</LocationMatch>

的-号改为+号

3 开启访问

进入配置界面vi httpd.conf

把里面的 AllowOverride None 全部修改为 AllowOverride All

顺便在 DirectoryIndex index.html 后面加上 index.htm index.php index.shtml

这个是配置默认首页的

:wq 保存退出 service httpd restart 重启 apache 服务

4 端口放行

firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld.service

然后打开http://ip/downloads/就行了

猜你喜欢

转载自www.cnblogs.com/dafang/p/9114598.html