diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 53d9e78..5a0813e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -279,6 +279,15 @@ jobs: exit 1 fi + NGINX_TEST_LOG=\$(mktemp) + if ! sudo nginx -t >"\$NGINX_TEST_LOG" 2>&1; then + echo "❌ Nginx configuration is invalid" >&2 + tail -50 "\$NGINX_TEST_LOG" >&2 || true + rm -f "\$NGINX_TEST_LOG" + exit 1 + fi + rm -f "\$NGINX_TEST_LOG" + echo "✓ Nginx 설정 검증 통과 (실제 로드 파일 확인 + 포트 5001 고정 + trailing slash 없음)" echo "--- [5/5] 헬스 체크 (최대 60초) ---" diff --git a/deploy_gb.sh b/deploy_gb.sh index 98f0581..91ee554 100644 --- a/deploy_gb.sh +++ b/deploy_gb.sh @@ -175,12 +175,16 @@ echo " ✓ No critical errors in logs" # 6.2 Nginx 설정 검증 echo " Checking Nginx configuration..." -if ! sudo nginx -t 2>&1 | grep -q "successful"; then +NGINX_TEST_LOG=$(mktemp) +if ! sudo nginx -t >"$NGINX_TEST_LOG" 2>&1; then echo "❌ Nginx configuration is invalid" + tail -50 "$NGINX_TEST_LOG" 2>/dev/null || true + rm -f "$NGINX_TEST_LOG" echo "🔙 Rolling back..." kill -9 $NEW_PID || true exit 1 fi +rm -f "$NGINX_TEST_LOG" echo " ✓ Nginx configuration is valid" # 6.3 프로세스가 여전히 실행 중인지 확인