fix: 修复SSL证书申请失败后仍显示成功的问题
问题描述: - Certbot申请证书失败后,脚本误报为成功 - 导致后续Nginx配置时找不到证书文件而失败退出 修复内容: - 检查certbot命令的返回码,正确判断成败 - 失败时显示常见失败原因 - 通过ssl_fallback函数提供备选方案 - 用户可选择其他SSL方案或暂不配置HTTPS 改进逻辑: 1. certbot执行成功 → 配置HTTPS 2. certbot执行失败 → 调用ssl_fallback 3. ssl_fallback提供选项: - 尝试其他SSL方案(acme.sh等) - 暂不配置HTTPS(使用HTTP模式) 4. SSL_METHOD=8时正确使用HTTP配置 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
20
install.sh
20
install.sh
@@ -1215,13 +1215,23 @@ deploy_certbot() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# 申请证书
|
# 申请证书
|
||||||
certbot --nginx -d "$DOMAIN" --non-interactive --agree-tos --email "admin@${DOMAIN}" --redirect
|
echo ""
|
||||||
|
if certbot --nginx -d "$DOMAIN" --non-interactive --agree-tos --email "admin@${DOMAIN}" --redirect; then
|
||||||
# 配置自动续期
|
# 配置自动续期
|
||||||
systemctl enable certbot.timer
|
systemctl enable certbot.timer 2>/dev/null || true
|
||||||
|
print_success "Certbot SSL证书申请成功"
|
||||||
print_success "Certbot SSL证书部署成功"
|
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
print_error "Certbot SSL证书申请失败"
|
||||||
|
echo ""
|
||||||
|
print_warning "常见失败原因:"
|
||||||
|
echo " 1. 域名未正确解析到此服务器"
|
||||||
|
echo " 2. 防火墙阻止了80/443端口"
|
||||||
|
echo " 3. Nginx未正确配置"
|
||||||
|
echo " 4. Let's Encrypt速率限制"
|
||||||
|
echo ""
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_acme_letsencrypt() {
|
deploy_acme_letsencrypt() {
|
||||||
|
|||||||
Reference in New Issue
Block a user