下载最新的Cloudreve
https://github.com/cloudreve/Cloudreve/releases
解压
tar -zxvf XXX.tar.gz
运行一次 生产配置文件
chmod +x ./cloudreve
./cloudreve
配置文件
[System]
; 运行模式
Mode = master
; 监听端口
Listen = :5000
; 是否开启 Debug
Debug = false
; Session 密钥, 一般在首次启动时自动生成
SessionSecret =
; Hash 加盐, 一般在首次启动时自动生成
HashIDSalt = something really hard to guss
; 数据库相关,如果你只想使用内置的 SQLite数据库,这一部分直接删去即可
[Database]
; 数据库类型,目前支持 sqlite | mysql
Type = mysql
; MySQL 端口
Port = 3306
; 用户名
User = root
; 密码
Password = root
; 数据库地址
Host = 127.0.0.1
; 数据库名称
Name = Cloudreve
; 数据表前缀
TablePrefix = cd
; SQLite 数据库文件路径
DBFile = cloudreve.db
; 从机模式下的配置
[Slave]
; 通信密钥
Secret =
; 回调请求超时时间 (s)
CallbackTimeout = 20
; 签名有效期
SignatureTTL = 60
; 跨域配置
[CORS]
AllowOrigins = *
AllowMethods = OPTIONS,GET,POST
AllowHeaders = *
AllowCredentials = false
; Redis 相关
[Redis]
Server = 127.0.0.1:6379
Password =
DB = 0
; 从机模式缩略图
[Thumbnail]
MaxWidth = 400
MaxHeight = 300
FileSuffix = ._thumb
Nginx反向代理配置
nginx反代
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:5212;
access_log /www/wwwlogs/www.***.***.log;
error_log /www/wwwlogs/www.***.***.error.log;
}
配置服务文件
vim /usr/lib/systemd/system/cloudreve.service
vim /etc/systemd/system/cloudreve.service
配置文件
[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
Wants=network.target
[Service]
WorkingDirectory=/root
ExecStart=/root/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed
StandardOutput=null
StandardError=syslog
[Install]
WantedBy=multi-user.target
# 更新配置
systemctl daemon-reload
# 启动服务
systemctl start cloudreve
# 设置开机启动
systemctl enable cloudreve
# 启动服务
systemctl start cloudreve
# 停止服务
systemctl stop cloudreve
# 重启服务
systemctl restart cloudreve
# 查看状态
systemctl status cloudreve