This commit is contained in:
Leo
2026-02-04 16:19:46 +08:00
parent 984b8f435e
commit a05119f99f
4 changed files with 39 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Jarvis 证书申请与安装acme.sh + 腾讯云 DNS
# 用法:上传到服务器后 chmod +x refresh_jarvis_cert.sh && ./refresh_jarvis_cert.sh
# 若报 $'\r': command not found先执行sed -i 's/\r$//' refresh_jarvis_cert.sh
set -e
cd /root/project/acme/acme.sh
# 1. 申请/续期证书(--force 强制续期ECC 用 --keylength ec-256
# --dnssleep 120添加 TXT 后等 2 分钟再让 CA 校验避免「retryafter too large」因 DNS 未生效
./acme.sh --dns dns_tencent --issue \
-d jarvis.van333.cn -d van333.cn \
--keylength ec-256 \
--dnssleep 120 \
--force \
--debug 2
# 2. 安装证书(--ecc 必须紧跟在 -d 域名后,避免 Unknown parameter
./acme.sh --install-cert -d jarvis.van333.cn --ecc \
--key-file /opt/1panel/apps/openresty/openresty/www/common/ssl/jarvis.van333.cn.key \
--fullchain-file /opt/1panel/apps/openresty/openresty/www/common/ssl/jarvis.van333.cn/fullchain.cer \
--reloadcmd "docker restart openresty"
# 3. 验证
echo "--- 证书文件 ---"
ls -l /opt/1panel/apps/openresty/openresty/www/common/ssl/
ls -l /opt/1panel/apps/openresty/openresty/www/common/ssl/jarvis.van333.cn/ 2>/dev/null || true
echo "--- 证书过期时间 ---"
openssl x509 -in /opt/1panel/apps/openresty/openresty/www/common/ssl/jarvis.van333.cn/fullchain.cer -noout -enddate 2>/dev/null || true