- 三库所有 .md/.txt 与配置样例中的 — – … § → 一律换成 ASCII(Gitea 的 「模棱两可的 Unicode 字符」告警即由这几个字符触发;中文全角标点不受影响, 实测 README.txt 修正后告警消失) - contracts/* 在三库保持逐字节一致(已校验 md5) - 残留真实值清理:README.txt 建库 SQL 的 dpendance -> opendance/opendance_app, Android HostDiscovery.kt 注释示例 192.168.1.23 -> 192.0.2.23 - Web README.txt 新增「初次部署(从零跑起来)」8 步清单与「常见问题(初次部署)」 7 条;去掉纯文本 README 里的 markdown 粗体标记;统一 '以 root 直接执行' 写法 - 重新打包 v0.2.0 验证:168 项单测通过;契约 6 项与 30 条路由一致。
106 lines
5.1 KiB
XML
106 lines
5.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<!--
|
||
============================================================
|
||
OpenDance Studio Web 服务端 -- IIS 反向代理样例
|
||
|
||
说明:本 Web 端不自带反向代理。本文件是**给你的反代服务参考**的配置样例。
|
||
|
||
前置条件(IIS 默认都不带,需自行安装):
|
||
1. URL Rewrite 模块
|
||
https://www.iis.net/downloads/microsoft/url-rewrite
|
||
2. Application Request Routing (ARR)
|
||
https://www.iis.net/downloads/microsoft/application-request-routing
|
||
3. 启用 ARR 代理(否则会 404.4):
|
||
IIS 管理器 -> 服务器节点 -> Application Request Routing Cache
|
||
-> Server Proxy Settings -> 勾选 Enable proxy
|
||
|
||
放置位置:IIS 站点根目录下的 web.config
|
||
|
||
后端(NestJS)同时监听两个端口,职责不同:
|
||
|
||
软件 API 端口(PORT,默认 3000)-- 给 Windows/Godot 客户端与 Android App
|
||
只有 /api、/health、/static、/contracts
|
||
管理端端口(ADMIN_PORT,默认 3001)-- 给浏览器
|
||
管理页面 + 上面全部接口
|
||
|
||
**在 IIS 里建两个站点**,把下面这份 web.config 各放一份,只改 <action> 里的端口:
|
||
站点 A(如 dance-api.example.com) -> http://127.0.0.1:3000/{R:1}
|
||
站点 B(如 dance-admin.example.com)-> http://127.0.0.1:3001/{R:1}
|
||
|
||
后端自带管理端页面与 SPA 回退,所以每个站点只需一条全匹配重写规则,
|
||
不需要在 IIS 上再配置默认文档或 URL Rewrite 的 SPA 回退。
|
||
============================================================
|
||
-->
|
||
<configuration>
|
||
<system.webServer>
|
||
|
||
<rewrite>
|
||
<rules>
|
||
<!--
|
||
全部请求转发给后端。
|
||
管理端站点把端口改成 3001;软件 API 站点保持 3000。
|
||
注意:软件 API 端口**不提供管理页面**,用浏览器访问它会得到 404,
|
||
这是有意设计(职责分离),不是配置错误。
|
||
-->
|
||
<rule name="OpenDanceReverseProxy" stopProcessing="true">
|
||
<match url="(.*)" />
|
||
<action type="Rewrite" url="http://127.0.0.1:3000/{R:1}" />
|
||
</rule>
|
||
</rules>
|
||
<!-- 若需要 HTTPS 终止,取消下面一段注释(IIS 侧装证书) -->
|
||
<!--
|
||
<outboundRules>
|
||
<rule name="RewriteRedirectToHttps" preCondition="IsRedirect">
|
||
<match serverVariable="RESPONSE_Location" pattern="^http://(.*)" />
|
||
<action type="Rewrite" value="https://{R:1}" />
|
||
</rule>
|
||
<preConditions>
|
||
<preCondition name="IsRedirect">
|
||
<add input="{RESPONSE_STATUS}" pattern="3\d\d" />
|
||
</preCondition>
|
||
</preConditions>
|
||
</outboundRules>
|
||
-->
|
||
</rewrite>
|
||
|
||
<security>
|
||
<requestFiltering>
|
||
<!-- ★ 上传上限 512 MiB。IIS 默认约 28.6 MB,不改大文件上传必失败(413) -->
|
||
<requestLimits maxAllowedContentLength="536870912" />
|
||
</requestFiltering>
|
||
</security>
|
||
|
||
<!-- ★ 与上一条配合:SSL 场景下请求体预读缓冲,默认仅 48 KB,不改仍会失败 -->
|
||
<serverRuntime uploadReadAheadSize="536870912" />
|
||
|
||
<!-- 保留原始 Host 头,后端日志与重定向才正确 -->
|
||
<proxy preserveHostHeader="true" />
|
||
|
||
<httpProtocol>
|
||
<customHeaders>
|
||
<remove name="X-Powered-By" />
|
||
</customHeaders>
|
||
</httpProtocol>
|
||
|
||
</system.webServer>
|
||
</configuration>
|
||
<!--
|
||
┌──────────────────────────────────────────────────────────────┐
|
||
│ 三个最常踩的坑 │
|
||
├──────────────────────────────────────────────────────────────┤
|
||
│ 0. 两个端口搞混。浏览器要访问的是**管理端端口 3001**; │
|
||
│ 客户端调用的是**软件 API 端口 3000**。指错会出现 │
|
||
│ "管理页面 404" 或 "接口全 404"。 │
|
||
│ │
|
||
│ 1. 代理超时是**服务器级**配置,不在 web.config 里。 │
|
||
│ ARR 默认 120 秒,上传大模型会中途断开。改 │
|
||
│ C:\Windows\System32\inetsrv\config\applicationHost.config │
|
||
│ 的 <webProxy> 节点: │
|
||
│ <webProxy enabled="true" timeout="00:05:00" /> │
|
||
│ 改完 iisreset 或重启 W3SVC。 │
|
||
│ │
|
||
│ 2. requestLimits 与 serverRuntime 必须**同时**改。 │
|
||
│ 只改前者,HTTPS 下仍会因 uploadReadAheadSize 太小而失败。 │
|
||
└──────────────────────────────────────────────────────────────┘
|
||
-->
|