fix:修改脚本

This commit is contained in:
Daniel
2026-03-08 17:23:00 +08:00
parent 890dea096b
commit 06c0e36d92
2 changed files with 25 additions and 4 deletions

View File

@@ -17,12 +17,13 @@ if ! ss -tlnp 2>/dev/null | grep -q ":$PORT "; then
fi
fi
echo "--- 测试 API ---"
# 独立后端路由为 /config无 /api 前缀Nginx 反代后浏览器请求 /api/config
if command -v curl >/dev/null 2>&1; then
resp=$(curl -s -o /dev/null -w "%{http_code}" "http://127.0.0.1:${PORT}/api/config" 2>/dev/null)
resp=$(curl -s -o /dev/null -w "%{http_code}" "http://127.0.0.1:${PORT}/config" 2>/dev/null)
if [ "$resp" = "200" ]; then
echo "GET /api/config 返回 200服务正常。"
echo "GET /config 返回 200服务正常。"
else
echo "GET /api/config 返回 ${resp},请检查服务。"
echo "GET /config 返回 ${resp},请检查服务。"
fi
else
echo "未安装 curl仅检查了端口监听。"