cloudreve PHP 网盘快速搭建
一、去GitHub下载程序版本:https://github.com/cloudreve/Cloudreve/releases
然后在你的服务器上解压,在输入以下命令:
#解压获取到的主程序
tar -zxvf 程序名.tar.gz
# 赋予执行权限
chmod +x ./cloudreve
# 启动 Cloudreve
./cloudreve
Cloudreve 默认会监听5212端口。你可以在浏览器中访问http://IP:5212进入 Cloudreve。(宝塔记得放行5212端口,并设置好反代可以直接域名访问)
二、设置开机自启
# 编辑配置文件
vim /usr/lib/systemd/system/cloudreve.service
注意将下文 PATH_TO_CLOUDREVE 更换为程序所在目录:
[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
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
配置无误:wq 保存退出,启动程序
# 更新配置
systemctl daemon-reload
# 启动服务
systemctl start cloudreve
# 设置开机启动
systemctl enable cloudreve
<br>管理命令:<br/>
<br># 启动服务<br/>
systemctl start cloudreve
# 停止服务
systemctl stop cloudreve
# 重启服务
systemctl restart cloudreve
# 查看状态
systemctl status cloudreve