创建 docker-compose.yml
mkdir -p /data/wwwroot/bitwarden
# 创建 docker-compose.yml
version: "3"
services:
bitwarden:
image: vaultwarden/server
container_name: bitwardenrs
restart: always
ports:
- "3256:80"
- "3012:3012"
volumes:
- ./bw-data:/data
environment:
WEBSOCKET_ENABLED: "true"
SIGNUPS_ALLOWED: "true"
WEB_VAULT_ENABLED: "true"
ADMIN_TOKEN: "openssl rand -base64 48 生成"
安装 Bitwarden_RS
cd /data/wwwroot/bitwarden && docker-compose up -d
Nginx 反代
location / {
proxy_pass http://127.0.0.1:3256;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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 X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_redirect off;
}
location /notifications/hub {
proxy_pass http://127.0.0.1:3012;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /notifications/hub/negotiate {proxy_pass http://127.0.0.1:3256;}
location /admin {
proxy_pass http://127.0.0.1:3256;
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 X-Forwarded-Proto $scheme;
}
关闭注册
cd /data/wwwroot/bitwarden && docker-compose down
#修改 SIGNUPS_ALLOWED: "true" 为 SIGNUPS_ALLOWED: "false"
nano docker-compose.yml
docker-compose up -d
正文完
发表至: 开源脚本
2023-02-11