From ad57bc5489cc9739ca53148ad6b3d0a454087380 Mon Sep 17 00:00:00 2001 From: huangjianwu Date: Wed, 17 Jun 2026 11:17:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(docker):=20=E4=BF=AE=E5=A4=8D=20Docker?= =?UTF-8?q?=20=E9=83=A8=E7=BD=B2=E6=89=93=E5=BC=80=E6=98=BE=E7=A4=BA=20ngi?= =?UTF-8?q?nx=20=E6=AC=A2=E8=BF=8E=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nginx/default.conf 被 docker-compose(多容器)与 Dockerfile.complete(单镜像) 共用,但两种模式对 location / 的需求相反:多容器需反代独立的 frontend 容器, 单镜像需直接服务本地静态文件。此前共用一份配置,导致其中一种部署总会回退到 nginx 默认欢迎页(本次为 compose 入口 nginx 用了 root 但容器内无前端产物)。 拆分为两份配置,各司其职、互不干扰: - nginx/default.conf:compose 版,location / 反代 http://frontend:80 - nginx/standalone.conf(新增):单镜像版,location / 服务 /usr/share/nginx/html, /api、/static 代理到本地 127.0.0.1:8483 - Dockerfile.complete 改用 standalone.conf,移除不再需要的 sed 改写 已用 nginx -t 校验 standalone.conf 语法通过。 Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile.complete | 7 +++---- nginx/default.conf | 6 +++--- nginx/standalone.conf | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 nginx/standalone.conf diff --git a/Dockerfile.complete b/Dockerfile.complete index 73d1afd..a7b0d67 100644 --- a/Dockerfile.complete +++ b/Dockerfile.complete @@ -90,11 +90,11 @@ WORKDIR /app/backend # 复制前端静态文件到 nginx COPY --from=frontend-builder /tmp/frontend/dist /usr/share/nginx/html -# 配置 nginx +# 配置 nginx(单镜像版:前端静态文件 + 本地 backend 代理,见 nginx/standalone.conf) RUN rm -rf /etc/nginx/conf.d/default.conf # 删除默认 nginx site,防止 default_server 劫持 80 端口 RUN rm -f /etc/nginx/sites-enabled/default -COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf +COPY ./nginx/standalone.conf /etc/nginx/conf.d/default.conf # 创建 supervisor 配置 # 关键点:supervisord 默认 *不* 把自己的环境变量传给子进程。 @@ -129,8 +129,7 @@ priority=20 environment=BACKEND_PORT="%(ENV_BACKEND_PORT)s",BACKEND_HOST="%(ENV_BACKEND_HOST)s",TRANSCRIBER_TYPE="%(ENV_TRANSCRIBER_TYPE)s",WHISPER_MODEL_SIZE="%(ENV_WHISPER_MODEL_SIZE)s",FFMPEG_BIN_PATH="%(ENV_FFMPEG_BIN_PATH)s",HF_ENDPOINT="%(ENV_HF_ENDPOINT)s",STATIC="%(ENV_STATIC)s",OUT_DIR="%(ENV_OUT_DIR)s",DATA_DIR="%(ENV_DATA_DIR)s",NOTE_OUTPUT_DIR="%(ENV_NOTE_OUTPUT_DIR)s",DATABASE_URL="%(ENV_DATABASE_URL)s",IMAGE_BASE_URL="%(ENV_IMAGE_BASE_URL)s",ENV="%(ENV_ENV)s",GROQ_TRANSCRIBER_MODEL="%(ENV_GROQ_TRANSCRIBER_MODEL)s" EOF -# 修改 nginx 配置:backend 代理到本地,前端由 nginx 直接服务静态文件 -RUN sed -i 's/proxy_pass http:\/\/backend:8483/proxy_pass http:\/\/127.0.0.1:8483/g' /etc/nginx/conf.d/default.conf +# nginx/standalone.conf 已直接写好本地 backend(127.0.0.1:8483)与前端静态服务,无需再 sed 改写。 # 启动 supervisor # 推荐启动方式(覆盖默认 env): diff --git a/nginx/default.conf b/nginx/default.conf index 1c3451d..efac1d1 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -8,10 +8,10 @@ server { gzip_proxied any; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; + # 多容器(docker-compose)部署:前端在独立的 frontend 容器,代理过去。 + # 单镜像(Dockerfile.complete)部署请勿用本文件,改用 nginx/standalone.conf。 location / { - root /usr/share/nginx/html; - index index.html; - try_files $uri $uri/ /index.html; + proxy_pass http://frontend:80; } location /api/ { diff --git a/nginx/standalone.conf b/nginx/standalone.conf new file mode 100644 index 0000000..be6d99c --- /dev/null +++ b/nginx/standalone.conf @@ -0,0 +1,41 @@ +# 单镜像(Dockerfile.complete / 一体化部署)专用 nginx 配置。 +# +# 与 nginx/default.conf(docker-compose 多容器版)的关键区别: +# - 前端不再由独立的 frontend 容器提供,构建产物已直接 COPY 到本镜像的 +# /usr/share/nginx/html,所以 location / 走【静态文件】而非反代 frontend; +# - backend 与 nginx 同处一个容器,所以 /api、/static 代理到 127.0.0.1:8483。 +# +# 注意:请勿把本文件的 location / 改成代理 frontend,否则单镜像里没有 frontend +# 服务,会回退到 nginx 默认欢迎页。多容器(compose)请改 nginx/default.conf。 +server { + listen 80; + client_max_body_size 10G; + + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_proxied any; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml; + + # 前端静态文件由本容器直接服务(构建产物已 COPY 到此目录) + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } + + # backend 与 nginx 同容器,代理到本地 + location /api/ { + proxy_pass http://127.0.0.1:8483; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /static/ { + proxy_pass http://127.0.0.1:8483/static/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + expires 7d; + add_header Cache-Control "public, immutable"; + } +} From 3002e311acf4b7967aabd77b011ce344811fcd30 Mon Sep 17 00:00:00 2001 From: huangjianwu Date: Wed, 17 Jun 2026 11:17:52 +0800 Subject: [PATCH 2/2] chore(release): 2.4.2 --- BillNote_frontend/src-tauri/tauri.conf.json | 2 +- CHANGELOG.md | 6 ++++++ README.md | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BillNote_frontend/src-tauri/tauri.conf.json b/BillNote_frontend/src-tauri/tauri.conf.json index be18719..f20bccb 100644 --- a/BillNote_frontend/src-tauri/tauri.conf.json +++ b/BillNote_frontend/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "BiliNote", - "version": "2.4.1", + "version": "2.4.2", "identifier": "com.jefferyhuang.bilinote", "build": { "frontendDist": "../dist", diff --git a/CHANGELOG.md b/CHANGELOG.md index 7340bf1..14aa5d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ 本项目所有重要变更记录于此。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),遵循 [语义化版本](https://semver.org/lang/zh-CN/)。 +## [2.4.2] - 2026-06-17 + +### Fixed + +- **Docker 部署打开显示 nginx 欢迎页**:`nginx/default.conf` 被 docker-compose(多容器)与 `Dockerfile.complete`(单镜像)共用,但两种模式对 `location /` 的需求相反(多容器需反代独立的 frontend 容器,单镜像需直接服务本地静态文件),导致其中一种部署方式总会回退到 nginx 默认欢迎页。现拆分为两份配置:`nginx/default.conf`(compose,反代 frontend 容器)与新增的 `nginx/standalone.conf`(单镜像,静态前端 + 本地 backend 代理);`Dockerfile.complete` 改用后者并删除 Debian 默认站点,两种部署方式均恢复正常。 + ## [2.4.1] - 2026-06-17 ### Added diff --git a/README.md b/README.md index 8618250..0914e52 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

BiliNote Banner

-

BiliNote v2.4.1

+

BiliNote v2.4.2

AI 视频笔记生成工具 让 AI 为你的视频做笔记