宝塔面板安装cloudreve网盘程序


1.在宝塔新建网站

2.进入网站目录,上传cloudreve文件并解压

3.进入cloudreve目录并赋权

cd /www/wwwroot/cloudreve目录
chmod +x ./cloudreve

4.在ssh工具中运行一次,记录下账号密码:

./cloudreve

5.在宝塔面板新建一个数据库,可起名为cloudreve

6.进入宝塔面板cloudreve根目录,会发现多出了配置文件conf.ini,修改这个文件,在下面插入以下数据库连接代码:

[Database]
Type = mysql
Port = 3306
User = root
Password = 你创建的数据库密码
Host = 127.0.0.1
Name = cloudreve
TablePrefix = cd_

7.Ctrl+C停止cloudreve,

8.再次启动cloudreve

cd /www/wwwroot/cloudreve目录
./cloudreve

会重新生成密码,记录下来!如果登陆显示密码不正确,请重新删除cloudreve和cloudreve.db,重新上传解压cloudreve,再重复操作!~

这样就会自动使用咱们自建的数据库,比cloudreve自带的简单数据库强很多。然后就可以删除网站目录自带的cloudreve.db

9.Cloudreve 默认会监听5212端口。打开ip:5212 即可访问。注意在宝塔面板-安全,开放端口 5212,还有开启443端口!!!

10.ngnix+SSL绑定域名配置

点击网站-SSL,申请Let’s Encrypt免费域名证书。或者从别的地方获取证书,将key和pem文件分别填入到宝塔面板的其他证书中。

点击 网站-配置文件,修改为以下配置,注意修改你的域名

server {  
    listen 80;  
    server_name 你的域名;  
   
    rewrite ^(.*)$  https://$host$1 permanent;  
}
    
    server {

listen 443 ssl;
server_name 你的域名;
#charset koi8-r;
#access_log logs/host.access.log main;
ssl_certificate /www/server/panel/vhost/cert/你的域名/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/你的域名/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:5212;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
root html;
index index.html index.htm;
client_max_body_size 4G;
keepalive_timeout 600;
}



        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }    


    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-00.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/你的域名.conf;
    #REWRITE-END

11.supervisor自启服务

在宝塔安装好supervisor之后,配置

名称:Cloudreve
启动用户:root 默认的
运行目录:/www/wwwroot/cloudreve/
启动命令:/www/wwwroot/cloudreve/cloudreve