第一步:安装docker
简单安装法:
sudo apt install docker.io
Bash查看docker是否安装成功
docker -v
Bash启动docker
sudo systemctl start docker
Bash设置docker服务开机自启动
sudo systemctl enable docker
Bash第二步:运行bitwarden_rs
使用Docker拉取bitwarden_rs镜像
docker pull bitwardenrs/server:latest
Bash运行bitwarden_rs
docker run -d --name bitwarden -v /bw-data/:/data/ -p 8800:80 bitwardenrs/server:latest
Bash上方8800端口可以根据需要自定义
第四步:安装nginx做反向代理与支持ssl
安装nginx
sudo apt install nginx
Bash修改配置文件开启ssl与反向代理
在/etc/nginx/conf.d下添加配置文件youdomain.com.conf
youdomain.com为用来访问的域名。
内容为
server { listen 80; #listen [::]:80; server_name youdomain.com; #把youdomain.com修改为用来访问的域名 rewrite ^/(.*) https://$server_name/$1 permanent; }server { listen 443 ssl http2; #listen [::]:443 ssl http2; server_name youdomain.com; #把youdomain.com修改为用来访问的域名 ssl on; ssl_certificate /etc/nginx/youdomain.com.crt; #修改为用来访问的域名的 ssl证书 ssl_certificate_key /etc/youdomain.com.key; #修改为用来访问的域名的 ssl证书# ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5"; ssl_session_cache builtin:1000 shared:SSL:10m; # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048 # ssl_dhparam /etc/nginx/dhparam.pem; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; location / { proxy_set_header Host zheteng.pw; proxy_pass http://127.0.0.1:8800; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } 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:8800; } }
Bash重启nginx
service nginx restart
Bash解析好域名后访问即可