Files
ipass__ipass/tests/gateway/nginx.conf.in
T
admin 5c307ba1aa iPass 山海关:Rust 动态模块版全量入库
- vanilla nginx + Rust 动态模块(取代 OpenResty+Lua),共享内存为运行期真源
- 三域名分流 18098 ssl:mdm 管理台 / lm LLM 代理 / *.dm 企业转发,共用 *.mayishangshu.cn 通配符证书(证书不入库)
- LLM 统一出口:同 Key 鉴权、上游 Key 替换、白名单、限流配额、SSE
- 回归夹具 tests/(网关 55 + LLM 34 = 89 断言,夹具 cp 覆盖重置)
- 文档:readme(16 章)+ CLAUDE.md + conf/tls/README(acme.sh 证书管理、hairpin 环回链路)
2026-09-11 15:37:09 +08:00

80 lines
2.5 KiB
Plaintext
Raw 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;
location = /admin {
default_type text/html;
alias @REPO@/www/admin.html;
}
location /api/ {
ipass_api on;
}
}
}