Featured image of post Debian11 安装 Cloudreve 开机自启

Debian11 安装 Cloudreve 开机自启

安装

文件夹可以自己更改

mkdir cloudreve && cd cloudreve

# 下载
wget https://github.com/cloudreve/Cloudreve/releases/download/3.7.1/cloudreve_3.7.1_linux_amd64.tar.gz

# 解压
tar -zxvf cloudreve_3.7.1_linux_amd64.tar.gz

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

# 启动 Cloudreve
./cloudreve

admin@cloudreve.org

qwamUkH3

记下用户名和密码

2023-02-26-debian_cloudreve

修改端口

目录下找到 conf.ini

Listen 就是端口号

[System]
Debug = false
Mode = master
Listen = :5212
SessionSecret =
HashIDSalt =

开机自启/后台运行

ctrl+o 保存

ctrl+x 退出

nano /etc/systemd/system/cloudreve.service
  • cloudreve.service
    • WorkingDirectory:运行文件夹名字
    • ExecStart:运行文件
    • 其他的不用改
[Unit]
Description=cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
After=mysqld.service
Wants=network.target

[Service]
WorkingDirectory=/zg/lib/cloudreve
ExecStart=/zg/lib/cloudreve/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

反代

nano /etc/nginx/conf.d/xxx.xxx.com.conf
server {
  listen 80;
  server_name xxx.xxx.com;

  access_log /var/wwwlogs/cloud.134333.xyz.log;
  error_log /var/wwwlogs/cloud.134333.xyz.error.log warn;


  location / {
    proxy_pass http://127.0.0.1:5212;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded         $proxy_add_forwarded;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_connect_timeout 60s;
    proxy_send_timeout 60s;
    proxy_read_timeout 60s;
  }
}
Licensed under CC BY-NC-SA 4.0
本博客已稳定运行
发表了53篇文章 · 总计28.17k字
使用 Hugo 构建
主题 StackJimmy 设计