利用服务器搭建Cloudreve,实现离线下载

0.环境说明:

建议服务器配置:Centos7 LNMP RAM 1G+ ,剩余磁盘空间20G+

如果嫌配置麻烦可以用宝塔等工具。

准备,①MYSQL数据库账户一个,如:

账户:pan_wolfmark_org 密码:wolfmark

②指向网盘域名的nginx网盘空间一个,宝塔的快速配置方法如下:

③php安装fileinfo插件

1.配置伪静态:

nginx方法:

location / {
 if (!-e $request_filename) {
 rewrite ^(.*)$ /index.php?s=/$1 last;
 break;
 }
 }

2.安装cloudreve:

①下载安装包到服务器:https://cloudreve.org/download.php

cd /www/wwwroot/pan.wolfmark.org
rm -f *
wget https://download.cloudreve.org/build/3620131c77c90ec59d5fce2572e7421592197ffc.zip
unzip 3620131c77c90ec59d5fce2572e7421592197ffc.zip
rm -f 3620131c77c90ec59d5fce2572e7421592197ffc.zip
chmod 777 -R /www/wwwroot/pan.wolfmark.org/application
chown www:www -R /www/wwwroot/pan.wolfmark.org/application

②访问:http://pan.wolfmark.org/CloudreveInstaller/, 查看显示为X的项并补全

安装二次验证的依赖库:

 composer require phpgangsta/googleauthenticator:dev-master
 composer require endroid/qrcode

③ php7删除putenv proc_open proc_get_status pcntl_signal 函数禁用

输入0中数据库账户密码安装
管理后台地址:
http://pan.wolfmark.org/Admin
账号:
admin@cloudreve.org
密码:
admin

3.安装aria2:

①到https://github.com/aria2/aria2/releases下载最新版:

wget https://github.com/aria2/aria2/releases/download/release-1.35.0/aria2-1.35.0.tar.gz
tar -xvf aria2-1.35.0.tar.gz
cd aria2-1.35.0
./configure
make
make install

2.配置aria2:

mkdir /etc/aria2

①下载标准配置文件:

wget --no-check-certificate -O "/etc/aria2/aria2.conf" "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/Aria2/aria2.conf"

wget --no-check-certificate -O "/etc/aria2/dht.dat" "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/Aria2/dht.dat"

touch  /etc/aria2/aria2.session
vi /etc/aria2/aria2.conf 

②修改aria2.session配置:

下载地址,和cloudreve后台一致:

dir=/www/wwwroot/pan.wolfmark.org/public/downloads
input-file=/etc/aria2/aria2.session
#RPC服务端口,默认是6800
rpc-listen-port=6800
#设置PRC服务的密钥,在后的配置中会用到,可以自己设定具体内容
rpc-secret=wolfmark.org
#底部添加
on-download-complete=/root/hook.sh

③添加service:

vi /lib/systemd/system/aria2.service

写入:

[Unit]
Description=aria2c

[Service]
User=root
ExecStart=/usr/local/bin/aria2c --conf-path=/etc/aria2/aria2.conf
Restart=on-abort

[Install]
WantedBy=multi-user.target

④添加hook.sh,解决权限问题:

vi /root/hook.sh
#写入
!/bin/sh
chown www:www -R /www/wwwroot/pan.wolfmark.org/public/downloads
chmod -R 777 /www/wwwroot/pan.wolfmark.org/public/downloads
chmod +x /root/hook.sh

4.其它配置:

①配置离线下载

进入 http://pan.wolfmark.org/Admin

在离线下载中填入下载目录和Token

②修改后台用户空间大小和离线下载权限:

用户组 页面修改

③重载DEAMON:

systemctl daemon-reload
systemctl enable aria2
systemctl restart aria2

发表评论

Your email address will not be published.