利用腾讯云轻量搭建私人云盘-Cloudreve
购买链接:https://cloud.tencent.com/act/pro/lighthouse
大陆地区1核1G3Mbps的机器128一年,非常适合小白和建站的同学。
港澳台和海外(新加坡、硅谷、东京莫斯科)统一提供30Mbps的带宽,月流量1024G起步的免备案机器,1核1G30Mbps的只要288一年
Cloudreve 可以让您快速搭建起公私兼备的网盘系统。Cloudreve 在底层支持不同的云存储平台,用户在实际使用时无须关心物理存储方式。你可以使用 Cloudreve 搭建个人用网盘、文件分享系统,亦或是针对大小团体的公有云系统。
#下载主程序
wget https://github.com/cloudreve/Cloudreve/releases/download/3.1.1/cloudreve_3.1.1_linux_amd64.tar.gz
#解压获取到的主程序
tar -zxvf cloudreve_3.1.1_linux_amd64.tar.gz
# 赋予执行权限
chmod +x ./cloudreve
# 启动 Cloudreve
./cloudreve
进程守护
# 编辑配置文件
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=/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
#添加Nginx包
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
#安装
sudo yum -y install nginx
#启动服务
sudo systemctl start nginx
#(如果启动失败,可能是Apache等服务占用了80端口,关掉相应服务/修改端口即可)
#设置nginx开机启动
sudo systemctl enable nginx
浏览器输入 服务器IP,出现welcome说明安装成功
yum install epel-release
wget https://dl.eff.org/certbot-auto --no-check-certificate
chmod +x certbot-auto
./certbot-auto
./certbot-auto -n
mkdir /www &&mkdir /www/log
删除原默认配置
rm -rf /etc/nginx/conf.d/default.conf
编辑nginx配置
vi /etc/nginx/conf.d/default.conf
server
{
listen 80;
listen 443 ssl http2;
server_name 替换你的域名;
if ($host != '替换你的域名'){
return 403;
}
if ($server_port = 80 ) {
return 301 https://$host$request_uri;
}
index index.php index.html index.htm default.php default.htm default.html;
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;
}
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /etc/letsencrypt/live/替换你的域名/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/替换你的域名/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
#SSL-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
access_log /www/log/access.log;
error_log /www/log/error.log;
}
重载nginx配置
nginx -s reload
var code = “ebae1432-6459-487e-a102-734ca0274850”