前期准备:
- 一个服务器安装好docker-ce,docker-compose
- 准备好自己的域名 my.yuming.com
详情请查看
部署步骤:
做一个docker-compose.yaml
#docker-compose.yaml version: '3' services: bitwarden: image: bitwardenrs/server restart: always volumes: - ./bw-data/:/data environment: WEBSOCKET_ENABLED: 'true' SIGNUPS_ALLOWED: 'false' # 不允许注册,第一次设置为true,注册好之后,再关闭 INVITATIONS_ALLOWED: 'false' caddy: image: abiosoft/caddy restart: always volumes: - ./Caddyfile:/etc/Caddyfile:ro #事先建好Caddyfile文件 - caddycerts:/root/.caddy ports: - 80:80 # needed for Let's Encrypt - 443:443 environment: ACME_AGREE: 'true' DOMAIN: 'my.yuming.com' # 改成你的域名 EMAIL: '12345678@qq.com' # 改成你的邮箱 volumes: caddycerts:准备好Caddyfile文件
# Caddyfile {$DOMAIN} { tls {$EMAIL} header / { # Enable HTTP Strict Transport Security (HSTS) Strict-Transport-Security "max-age=31536000;" # Enable cross-site filter (XSS) and tell browser to block detected attacks X-XSS-Protection "1; mode=block" # Disallow the site to be rendered within a frame (clickjacking protection) X-Frame-Options "DENY" # Prevent search engines from indexing (optional) #X-Robots-Tag "none" } # The negotiation endpoint is also proxied to Rocket proxy /notifications/hub/negotiate bitwarden:80 { transparent } # Notifications redirected to the websockets server proxy /notifications/hub bitwarden:3012 { websocket } # Proxy the Root directory to Rocket proxy / bitwarden:80 { transparent } }运行docker-compose up -d