diff --git a/install.sh b/install.sh index f3481bd..a460730 100644 --- a/install.sh +++ b/install.sh @@ -2585,7 +2585,7 @@ health_check() { fi # 检查端口 - if netstat -tunlp | grep -q ":${BACKEND_PORT}"; then + if netstat -tunlp 2>/dev/null | grep -q ":${BACKEND_PORT}" || ss -tunlp 2>/dev/null | grep -q ":${BACKEND_PORT}"; then print_success "后端端口监听正常 (${BACKEND_PORT})" else print_error "后端端口监听异常" @@ -2593,11 +2593,22 @@ health_check() { fi # 检查Nginx - if systemctl is-active --quiet nginx; then - print_success "Nginx服务运行正常" + if [[ -d /www/server/nginx ]]; then + # 宝塔面板:检查进程 + if pgrep -x nginx > /dev/null; then + print_success "Nginx服务运行正常" + else + print_error "Nginx服务异常" + return 1 + fi else - print_error "Nginx服务异常" - return 1 + # 标准Nginx:使用systemctl检查 + if systemctl is-active --quiet nginx; then + print_success "Nginx服务运行正常" + else + print_error "Nginx服务异常" + return 1 + fi fi # 检查数据库