fix(deploy): root path redirect to admin (cn) — persisted in template+compose
用户约定:32005 根路径打开即管理后台。之前是直接改在服务器容器配置上的,
历次镜像重建被冲掉——本次固化进仓库:nginx 模板 location = / → 302
${ROOT_REDIRECT};Dockerfile 默认 /admin/;compose 按栈注入(cn=/admin/,
ov=/index.html 观众端安全自指,不影响 /a/<token> 与嵌入路径)。
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,8 @@ FROM nginx:alpine
|
||||
# 官方镜像启动时 envsubst 渲染 /etc/nginx/templates/*.template → conf.d;
|
||||
# API_UPSTREAM 由 compose environment 注入(缺省指向 cn API 容器名)。
|
||||
ENV API_UPSTREAM=http://api-cn:8080
|
||||
# 根路径跳转目标(cn 默认进后台;ov 栈 compose 覆盖为 /index.html 安全自指)。
|
||||
ENV ROOT_REDIRECT=/admin/
|
||||
COPY infra/deploy/nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY --from=build /app/apps/viewer/dist /usr/share/nginx/html/viewer
|
||||
COPY --from=build /app/apps/admin/dist /usr/share/nginx/html/admin
|
||||
|
||||
@@ -36,6 +36,7 @@ services:
|
||||
init: true
|
||||
environment:
|
||||
API_UPSTREAM: http://api-ov:8081
|
||||
ROOT_REDIRECT: /index.html # 根路径直达(cn=进后台;ov=观众端安全自指)
|
||||
ports:
|
||||
# 同 cn:默认只绑回环供同机 OpenResty 反代(ov 侧主机端口用 8089 区分)。
|
||||
- "127.0.0.1:8089:80"
|
||||
|
||||
@@ -64,6 +64,7 @@ services:
|
||||
init: true
|
||||
environment:
|
||||
API_UPSTREAM: http://api-cn:8080 # /v1 反代目标(含 WS /v1/realtime)
|
||||
ROOT_REDIRECT: /admin/ # 根路径直达(cn=进后台;ov=观众端安全自指)
|
||||
ports:
|
||||
# 只绑本机回环:1Panel OpenResty(同宿主机)反代到 127.0.0.1:8088;
|
||||
# OpenResty 在其它机器时改为 "8088:80" 并配防火墙白名单。
|
||||
|
||||
@@ -71,6 +71,14 @@ server {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 根路径直达(用户约定 2026-09-23:cn 入口 / 打开即管理后台)。
|
||||
# ROOT_REDIRECT 由 compose 按栈注入:cn=/admin/(进后台);ov=/index.html
|
||||
# (观众端安全自指,等价原 viewer 首页)。仅精确匹配 /,不影响 /a/<token>
|
||||
# 等 viewer 路由与嵌入路径。
|
||||
location = / {
|
||||
return 302 ${ROOT_REDIRECT};
|
||||
}
|
||||
|
||||
# viewer SPA history 路由回退。
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
Reference in New Issue
Block a user