使用子域名部署bitwarden

使用子域名部署bitwarden

之前把bitwarden成功部署在主域名上文章,但占用了主页 。改为使用subpath不是太舒服又会遇到插件无法打开网页版的小问题(可能是我的Caddy配置不对。。。)。所以就把bitwarden部署在子域名下,顺带学习一下网络知识

步骤

域名添加一条A记录

我的vps、域名都是阿里云的,在域名解析上添加一个w子域名的A记录

在这里插入图片描述

DNS资源记录,这几个一定要记住:

A: 域名指向ipv4地址

AAAA:域名指向ipv6地址

CNAME:域名指向另外一个域名

MX:域名指向邮件服务器

NS:指向另外的DNS解析

在这里插入图片描述

ping一下,确认域名已经解析成功。由于是阿里云的vps,一定要用备案的域名哟。。。。

修改Caddy配置

添加一个w.domain.xyz的配置,具体可以看GitHub的示例https://github.com/dani-garcia/vaultwarden/wiki/Proxy-examples

[root@deng caddy]# cat Caddyfile
(common) {
        header /* {
                -Server
        }

        encode gzip

        route /otp* {
                uri strip_prefix /otp
                reverse_proxy 0.0.0.0:8090
        }

        log {
                output file /var/log/caddy/d.com-access.log {
                        roll_size 10mb
                        roll_keep 20
                        roll_keep_for 720h
                }
        }
}

domain.xyz {
        root * /usr/share/caddy
        file_server

        import common
}

# subdomian
w.domain.xyz {
        # Notifications redirected to the websockets server
        reverse_proxy /notifications/hub 0.0.0.0:3012

        reverse_proxy 0.0.0.0:8080 {
                # Send the true remote IP to Rocket, so that vaultwarden can put this in the
                # log, so that fail2ban can ban the correct IP.
                header_up X-Real-IP {remote_host}
        }
        import common
}

重启caddy

docker restart caddy

验证

访问子域名一切正常,收工
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值