Files
ruoyi-java/doc/refresh_jarvis_cert.sh
2026-02-04 16:44:32 +08:00

30 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 "--- 证书文件 ---"1
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