基于Cloudreve的网盘项目搭建

过去在腾讯云函数上基于OneManger-PHP项目搭建了网盘文件索引项目,若干年后,腾讯云函数的突然收费迫使弃用之前的OneManager项目

前车之鉴,再次部署时平台选用 Glitch,配合CDN实现国内访问,很遗憾,目前错误代码525

开始

Cloudreve

文档地址:Cloudreve

项目文档写的还是比较清楚的,快速开始居然是真快速开始。。。。

当然,docker部署更加方便,本次采用直接安装的方式

部署

  • Linux 下,直接解压并执行主程序即可:
访问Cloudreve项目地址,wget下载Releases

VPS是X86架构的CPU,选择范围有:X86、X86_64、AMD64
#t解压获取到的主程序
tar -zxvf cloudreve_3.8.0_linux_amd64.tar.gz

# 赋予执行权限
chmod +x ./cloudreve

# 启动 Cloudreve
./cloudreve
  • nginx代理配置
 目前整个VPS的对外服务都接管在v2talk.icu,新建server服务块,配置如下即可:

server {
listen 443 ssl;
server_name storage.v2talk.icu;

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   proxy_set_header Host $http_host;   proxy_redirect off;   proxy_pass http://127.0.0.1:5212;
}
}
说明:Cloudreve 首次启动日志info信息中会输出管理员权柄信息请注意保管!!!

  • 进程守护
要保持服务后台运行,需要添加进程守护,采用systemd方式进行配置
# 新建配置文件
vi /usr/lib/systemd/system/cloudreve.service
内容如下,其中将下文 PATH_TO_CLOUDREVE 更换为程序所在目录:
[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
After=mysqld.service
Wants=network.target

[Service]
WorkingDirectory=/PATH_TO_CLOUDREVE
ExecStart=/PATH_TO_CLOUDREVE/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed

StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target
注:可通过pwd查看当前所在目录绝对路径
# 更新配置
systemctl daemon-reload

# 启动服务
systemctl start cloudreve

# 设置开机启动
systemctl enable cloudreve
安装完成!





评论

此博客中的热门博文

Docker项目:Zfile