利用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/就行了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM