vps交流

[美国VPS] 为你宝塔面板一键开启HTTPS登陆+自动续期(面板+站点)


本帖最后由 帝玺SSL 于 2022-8-10 03:53 编辑

阅读 https://www1.hi.cn/docs/best-practice/secure-aapanel-https

总结起来就是一段SSH命令:

  1. email="[email protected]" # 记得修改成你的邮箱
  2. ip=$(curl -s -4 ip.sb)
  3. webroot=$(cat $((grep -r " "$ip /www/server/panel/vhost/nginx/ || grep -r "default_server" /www/server/panel/vhost/nginx/) | grep server_name | awk ‘{print $1}’ | cut -d ‘:’ -f1) | egrep ‘root ‘ | awk ‘{print $2}’ | cut -d ‘;’ -f1)
  4. if [ -z "$webroot" ]; then
  5.   echo "请先创建1个IP站点或者设置1个默认站点!"
  6.   exit 1
  7. fi
  8. export LE_WORKING_DIR=/root/.acme.sh
  9. /bin/cp -rf /www/server/panel/ssl/privateKey.pem /www/server/panel/ssl/privateKey.pem.bak
  10. /bin/cp -rf /www/server/panel/ssl/certificate.pem /www/server/panel/ssl/certificate.pem.bak
  11. /bin/cp -rf /www/server/panel/vhost/cert/$ip/privkey.pem /www/server/panel/vhost/cert/$ip/privkey.pem.bak
  12. /bin/cp -rf /www/server/panel/vhost/cert/$ip/fullchain.pem /www/server/panel/vhost/cert/$ip/fullchain.pem.bak
  13. /root/.acme.sh/acme.sh –register-account
  14.     –email $email
  15.     –server https://acme.hi.cn/directory &&
  16.    
  17. /root/.acme.sh/acme.sh –issue
  18.     -d $ip –webroot $webroot
  19.     –server https://acme.hi.cn/directory
  20.     –force &&
  21.    
  22. echo "复制宝塔面板证书" &&
  23. /bin/cp -rf /root/.acme.sh/$ip/$ip.key /www/server/panel/ssl/privateKey.pem &&
  24. /bin/cp -rf /root/.acme.sh/$ip/fullchain.cer /www/server/panel/ssl/certificate.pem &&
  25.    
  26. echo "True" > /www/server/panel/data/ssl.pl &&
  27.    
  28. bt reload &&
  29.    
  30. echo "安装站点证书(如有)" &&
  31. /bin/cp -rf /root/.acme.sh/$ip/$ip.key /www/server/panel/vhost/cert/$ip/privkey.pem &&
  32. /bin/cp -rf /root/.acme.sh/$ip/fullchain.cer /www/server/panel/vhost/cert/$ip/fullchain.pem &&
  33.    
  34. bt reload &&
  35.    
  36. echo "成功续期"

复制代码

ECC 通配符 10 块一年是吧
沪ICP备20022337号-17
前排占个坑再说,马克[美国VPS]  为你宝塔面板一键开启HTTPS登陆+自动续期(面板+站点)[美国VPS]  为你宝塔面板一键开启HTTPS登陆+自动续期(面板+站点)
赞(0)
版权声明:本贴采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
帖子名称:《[美国VPS] 为你宝塔面板一键开启HTTPS登陆+自动续期(面板+站点)》
帖子链接:https://bbs.toot.su/152108.html

相关推荐