Files
adminandClaude Opus 4.8 bf2528de0f refactor: depend on ../ipass-plugin-{domain,llm,apix} + ../ipass-core; strip local copies
Ruling 16:删除危险的 /static/plugins alias(暴露整个 workspace 根,含各仓
data/*.json),改为 scripts/collect-plugin-dist.sh 收集 core 壳与各启用插件
www dist 进 build/{shell,static-plugins}(build/ 已 gitignore),conf 与
tests 模板同构改指收集目录。www/*.html 多页管理台删除后由 ipass-core 壳接管。
deploy/data-seed/plugin-config.json 种子三插件配置(tracked)。

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-09-24 18:34:32 +08:00

119 lines
4.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================================
# 域名网关 · 本机回归配置模板(**不是**仓库里的生产配置 conf/nginx.conf)
#
# 由 tests/run.sh 渲染:@MODULE@ / @REPO@ / @RUN@ 三个占位符会替换成绝对路径。
# **不要把这个模板直接交给 nginx**(占位符没替换会 load_module 失败)。
#
# 与生产配置的差异(均因本机 nginx 编译时关闭了 rewrite 模块):
# * 无 set / return / error_page 重定向
# * 端口 18080(转发) / 18081(靶机) / 18082(管理)
# * 状态目录 @RUN@/data —— 独立目录,**绝不碰生产 data/**
# ============================================================================
load_module @MODULE@;
worker_processes 2;
error_log @RUN@/logs/error.log info;
pid @RUN@/logs/nginx.pid;
events {
worker_connections 1024;
}
http {
default_type application/json;
log_format main '$remote_addr "$request" $status backend=$proxy_backend_addr';
access_log @RUN@/logs/access.log main;
sendfile on;
keepalive_timeout 65;
ipass_state state 10m;
ipass_data_dir @RUN@/data;
# ---- 靶机:模拟内网后端(e2e 断言返回体里的 "from":"backend")----
server {
listen 18081;
server_name _;
root @REPO@/tests/gateway/backend;
location / { }
}
# ---- 转发 server ----
server {
listen 18080;
# 本机 nginx 未编 PCRE,不能用正则 server_name。
# 无妨:模块自己从 Host 头解析子域名,不依赖 nginx 的捕获变量。
server_name _;
location / {
ipass_proxy on;
proxy_pass http://$proxy_backend_addr;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 5s;
proxy_read_timeout 300s;
}
}
# ---- 管理 server ----
server {
listen 18082;
server_name proxy-api.yourdomain.com localhost;
client_max_body_size 2m;
# 必须大于最大 API 请求体,否则 body 落临时文件 → 模块读不到(表现为「参数缺失」)
client_body_buffer_size 1m;
# 与生产 conf 同构:路由器反代场景下保持 Location 相对路径
absolute_redirect off;
port_in_redirect off;
# 与生产 conf 同构(Ruling 16 改造):管理台核心壳来自
# scripts/collect-plugin-dist.sh 收集的 @REPO@/build/shell
# (旧 www/*.html 多页已删除)。SPA 深链 /admin/overview.html 等
# 未命中文件一律回壳 index.html,200 + no-store 语义保持不变。
#
# **不发版不重启也能修好缓存**:壳 HTML 一律 `Cache-Control: no-store`
# (assets 带 hash 可缓存)。不加的话用户浏览器会一直用发版前的旧壳。
root @REPO@/build/shell;
index index.html;
location = /admin {
return 302 /admin/;
}
location /admin/ {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-store" always;
}
location = /index.html {
add_header Cache-Control "no-store" always;
}
location /assets/ { }
location /api/ {
ipass_api on;
}
# 上游连通性测试:/api/admin/upstreams/test 内部重定向到这里
# (与生产 conf 同套:proxy_pass 复用 $llm_*,探测体原样转发,状态透传)
location /_upstream_test/ {
internal;
proxy_pass $llm_target;
proxy_http_version 1.1;
proxy_pass_request_headers off;
proxy_set_header Host $llm_host;
proxy_set_header Authorization $llm_auth;
proxy_set_header Content-Type $http_content_type;
proxy_set_header Accept $http_accept;
# 探测体由管理台原样发来(含登记模型),不注入任何覆盖体——
# 见 conf/nginx.conf 同 location 的告诫注释与 llm e2e【11】静态闸。
proxy_connect_timeout 5s;
proxy_send_timeout 15s;
proxy_read_timeout 15s;
}
}
}