diff --git a/install.sh b/install.sh index dae76fd..4cfeaf7 100644 --- a/install.sh +++ b/install.sh @@ -1215,13 +1215,23 @@ deploy_certbot() { esac # 申请证书 - certbot --nginx -d "$DOMAIN" --non-interactive --agree-tos --email "admin@${DOMAIN}" --redirect - - # 配置自动续期 - systemctl enable certbot.timer - - print_success "Certbot SSL证书部署成功" - return 0 + echo "" + if certbot --nginx -d "$DOMAIN" --non-interactive --agree-tos --email "admin@${DOMAIN}" --redirect; then + # 配置自动续期 + systemctl enable certbot.timer 2>/dev/null || true + print_success "Certbot SSL证书申请成功" + 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() {