# 快速诊断 /itdesk/ 500 错误

**Claude 无法直接 SSH(Windows known_hosts 权限 + 堡垒机交互登录限制),需你跑下面命令并把输出贴回。**

---

## 🚀 一键跑法(推荐)

**完整脚本已写到** `D:\资料\03-项目开发\wecom_it_smart_desk-claude\diagnose-500.sh`(3484 字节)

**步骤**:

1. **上传脚本到服务器**(`/tmp/`):
   ```powershell
   # 你在 PowerShell(堡垒机后的 Windows)跑:
   scp "D:\资料\03-项目开发\wecom_it_smart_desk-claude\diagnose-500.sh" user@10.90.5.110:/tmp/
   # (用你自己的文件传输方式,因为堡垒机禁 scp ProxyJump)
   ```

2. **PuTTY 登录**:
   - Host:`10.212.189.210`,Port:`2222`,SSH → Open
   - 用户 `sxn` + 密码
   - 堡垒机内 `ssh sxn@10.90.5.110` 跳目标机

3. **在服务器上跑**:
   ```bash
   sudo cp /tmp/diagnose-500.sh /opt/wecom-it-desk/
   cd /opt/wecom-it-desk
   bash diagnose-500.sh > /tmp/diag.log 2>&1
   cat /tmp/diag.log
   ```

4. **把 /tmp/diag.log 的内容贴回 Claude**

---

## 🛠️ 或者手敲(精简版)

```bash
# 1. 容器状态
docker compose ps

# 2. dist 目录在不在
ls /opt/wecom-it-desk/frontend-h5/dist/
ls /opt/wecom-it-desk/frontend-h5/dist/assets/

# 3. nginx 容器内能看到 dist 吗
docker compose exec nginx ls /usr/share/nginx/html/itdesk/
docker compose exec nginx ls /usr/share/nginx/html/itdesk/assets/

# 4. SSL 证书
docker compose exec nginx ls /etc/nginx/ssl/

# 5. 直接 curl 测试
curl -ksI https://itsupport.servyou.com.cn/itdesk/ | head -10
curl -ksI https://itsupport.servyou.com.cn/itportal/ | head -10
curl -ksI https://itsupport.servyou.com.cn/itagent/ | head -10
curl -ksI https://itsupport.servyou.com.cn/itadmin/ | head -10

# 6. nginx 日志
docker compose logs --tail=20 nginx
docker compose logs --tail=20 backend
```

---

## 🎯 我会关注

| 现象 | 诊断 |
|---|---|
| `ls /opt/wecom-it-desk/frontend-h5/dist/` 显示 **No such file** | 部署包没含 H5 dist(nginx 会 404 → 但一般不会 500) |
| `docker compose exec nginx ls /usr/share/nginx/html/itdesk/` 失败 | nginx 容器挂载路径错了,或 dist 没拷贝进去 |
| `curl -ksI https://itsupport.servyou.com.cn/itdesk/` 返回 **HTTP/1.1 500** | 后端代理或 SPA 内部错误 |
| `curl -ksI https://itsupport.servyou.com.cn/itportal/` 也 500 | **全站问题**,看 nginx 日志 |
| `curl -ksI https://itsupport.servyou.com.cn/itportal/` 200 但 /itdesk/ 500 | **H5 端特定问题**,看 nginx 容器内的文件 |
| nginx 错误日志有 **proxy_pass 错误** | 后端没启动或端口不通 |
| nginx 错误日志有 **"rewrite ... cycle"** | try_files 死循环,需修 nginx 配置 |

---

> 把输出贴回 Claude 后,我会精确定位 500 根因并给出最小修复。
