实现网站https访问需要申请ssl证书,亚洲诚信 提供了最普通的 免费一年 的ssl证书,每个网站限制申请20张有效证书。
如果网站子域名比较多,每次都要申请、配置、部署,非常麻烦。
默认的证书是feater.top和www.feater.top,如果需要git.feater.top证书需要重新申请部署,而通配证书*.feater.top可以用于所有子域名。
Let’s Encrypt提供了免费通配证书,有效期为三个月。
ssl证书每年替换一次,价格比较贵。所以,使用免费的,但是免费的有效期短。
不过gayhub上的大佬有方法。
  工具先安装官方的工具
1 sudo  apt install certbot
然后下载自动部署工具
1 git clone  https://github.com/ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au.git
安装仓库说明修改配置。
打开au.sh
添加腾讯secret id/key
自动部署工具可以使用此id/key,自动添加删除DNS记录
  申请1 sudo  certbot certonly --manual -d "*.jackeylea.com"  -d "jackeylea.com"  --agree-tos --email 1768478912@qq.com --server https://acme-v02.api.letsencrypt.org/directory --preferred-challenges dns --dry-run --manual-auth-hook "/home/ubuntu/certbot-renew/au.sh python txy add"  --manual-cleanup-hook "/home/ubuntu/certbot-renew/au.sh python txy clean" 
certonly 只申请证书 -d参数表示需要申请的域名--agree-tos 是同意不平等条约–server api地址 –preferred-challenges 优先验证方式,默认是dns和文件验证 –dry-run 表示当前为测试,不会真正申请证书 后续两个参数为自动验证和清理的脚本地址 实际操作输出为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Saving debug log  to /var/log/letsencrypt/letsencrypt.log Requesting a certificate for  *.jackeylea.com and jackeylea.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/jackeylea.com/fullchain.pem Key is saved at:         /etc/letsencrypt/live/jackeylea.com/privkey.pem This certificate expires on 2023-02-18. These files will be updated when the certificate renews. Certbot has set  up a scheduled task to automatically renew this certificate in  the background. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you like Certbot, please consider supporting our work by:  * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate  * Donating to EFF:                    https://eff.org/donate-le - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  定时刷新添加cron
1 1 1 */1 * * root certbot renew --manual --preferred-challenges dns --deploy-hook "systemctl restart nginx"  --manual-auth-hook "/home/ubuntu/certbot-renew/au.sh python txy add"  --manual-cleanup-hook "/home/ubuntu/certbot-renew/au.sh python txy clean" 
每天1点会自动执行命令来更新证书,但是只有在证书实际有效期小于30天时才会真正更新证书
  SSL证书检测