nginx server_name 手动加 n1
SolarFlow 走 4 VPS 独立架构 → 此问题直接消失。 仅 n+f 合并架构需要在同一份 nginx.conf 里写两个 server_name。
Agent 的 nginx.conf 中
server_name只包含f1.getgrowth.app,不包含n1.getgrowth.app。Press 推送 n1 的 Agent Job 时,Host header 不匹配 nginx 的 server_name,请求到不了 Agent。
1. 归属
| 问题 | 答案 |
|---|---|
| 属于哪个仓库? | frappe/agent 的 nginx 模板生成逻辑 |
| 在容器内路径? | 宿主机 /home/frappe/agent/nginx.conf |
| 在构建链的哪一步? | Agent setup 时从模板生成 |
2. 功能解释
Agent 的 nginx 做什么?
Agent 自带一个 nginx,作为 Press 推送 Job 的入口。Press POST Job 到 https://n1.getgrowth.app/agent/jobs,Agent nginx 接收后转发给 Agent 进程。
server_name 的作用?
nginx 用 server_name 匹配请求的 Host header。如果 Host 不匹配任何 server_name,nginx 返回 404。
3. 为什么会出现这个问题
n+f 合并架构:Agent 只注册为 f1.getgrowth.app,模板只生成 server_name f1.getgrowth.app。n1 Job 的 Host 是 n1.getgrowth.app → 不匹配 → nginx 拒收。
4. 补丁/修改做了什么
sed -i 's/server_name f1.getgrowth.app;/server_name f1.getgrowth.app n1.getgrowth.app;/' nginx.conf && supervisorctl restart
5. 性质判断
workaround。n+f 合并架构专属,原理清晰。但重建后需重新执行。
6. 正确做法
独立 n-B + f-B 架构 → 不存在这个问题。如果 n+f 合并,playbook 中 nginx 模板写死两个 server_name。
7. 影响范围
- Add Site to Upstream Job 的投递
- 容器重建后重现