docker安装

curl -sSL get.docker.com | sh

安装bitwarden

docker run -d --restart=always --name vaultwarden \
-e WEBSOCKET_ENABLED=true \
-v /root/bitwarden/data/:/data/ \
-p xx:80 \
-p xxxx:3012 \
vaultwarden/server:latest

-e ADMIN_TOKEN=你自己的后台token \
-e TZ=Asia/Shanghai \
-e LOG_FILE=/data/log/vaultwarden.log \

nginx配置片段

#PROXY-START/

location /
{
    proxy_pass http://127.0.0.1:50180;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    # proxy_hide_header Upgrade;

    add_header X-Cache $upstream_cache_status;

    #Set Nginx Cache
    
    
    set $static_filemZ9J9aBz 0;
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
        set $static_filemZ9J9aBz 1;
        expires 12h;
        }
    if ( $static_filemZ9J9aBz = 0 )
    {
    add_header Cache-Control no-cache;
    }
}
location /notifications/hub {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://127.0.0.1:53012;
  }

#PROXY-END/

rclone备份脚本

#!/bin/bash
# 定义备份目录
GD_PATH="od-backup:/backup/bitwarden"

# 定义备份的目录及文件,不同的目录用空格分开
BACKUP_SRC="/root/bitwarden"

# 定义临时文件存放目录
BACKUP_DST="/root/backup"

# 定义压缩密码
ZIP_PASS="*&^S*&2323s3JS"

# 定义文件前缀名
NOW=$(date +"%Y.%m.%d")
OLD=$(date -d -180day +"%Y.%m.%d")

# 备份网站数据文件
zip -r -P $ZIP_PASS $BACKUP_DST/auto_fileData_$NOW.zip $BACKUP_SRC

# 使用rclone上传到onedrive
rclone copy $BACKUP_DST/ --include "auto_fileData_$NOW.zip" $GD_PATH

# 删除本地的临时文件
rm -f $BACKUP_DST/auto_fileData_$NOW.zip

# 删除180天前的备份
rclone delete $GD_PATH/ --include "auto_fileData_$OLD.zip"
声明:本站所有文章或资源,均来自互联网分享。本站不参与制作或存储,内容仅用于互联网爱好者学习和研究,如不慎侵犯了您的权利,请及时联系站长处理删除。敬请谅解!