Compare commits

...

5 Commits

Author SHA1 Message Date
huangjianwu
3002e311ac chore(release): 2.4.2 2026-06-17 11:17:52 +08:00
huangjianwu
ad57bc5489 fix(docker): 修复 Docker 部署打开显示 nginx 欢迎页
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) <noreply@anthropic.com>
2026-06-17 11:17:52 +08:00
huangjianwu
a7d8995f3a Merge branch 'release/2.4.1' 2026-06-17 10:20:57 +08:00
Jianwu Huang
16a0dd4aec Merge pull request #406 from fivedang/fix/nginx-default-page 2026-06-15 10:30:43 +08:00
fivedang
39d051cc36 fix: nginx default page hijacks port 80 in Docker image
Two issues in Dockerfile.complete caused the nginx welcome page to appear
instead of the BiliNote UI:

1. /etc/nginx/sites-enabled/default had `listen 80 default_server` which
   took priority over the custom config in conf.d/
2. The nginx config proxied / to frontend:80, but the Dockerfile sed
   replaced it with 127.0.0.1:8080 where no service was running. The
   frontend is built as static files in /usr/share/nginx/html/.

Fix:
- Remove /etc/nginx/sites-enabled/default in Dockerfile
- Change location / to serve static files directly instead of proxying
- Remove the frontend proxy sed (no longer needed)
2026-06-15 00:19:54 +08:00
6 changed files with 56 additions and 10 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -90,9 +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
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
# 删除默认 nginx site防止 default_server 劫持 80 端口
RUN rm -f /etc/nginx/sites-enabled/default
COPY ./nginx/standalone.conf /etc/nginx/conf.d/default.conf
# 创建 supervisor 配置
# 关键点supervisord 默认 *不* 把自己的环境变量传给子进程。
@@ -127,9 +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
RUN sed -i 's/proxy_pass http:\/\/backend:8483/proxy_pass http:\/\/127.0.0.1:8483/g' /etc/nginx/conf.d/default.conf && \
sed -i 's/proxy_pass http:\/\/frontend:80/proxy_pass http:\/\/127.0.0.1:8080/g' /etc/nginx/conf.d/default.conf
# nginx/standalone.conf 已直接写好本地 backend(127.0.0.1:8483)与前端静态服务,无需再 sed 改写。
# 启动 supervisor
# 推荐启动方式(覆盖默认 env

View File

@@ -3,7 +3,7 @@
<p align="center">
<img src="./doc/icon.svg" alt="BiliNote Banner" width="50" height="50" />
</p>
<h1 align="center" > BiliNote v2.4.1</h1>
<h1 align="center" > BiliNote v2.4.2</h1>
</div>
<p align="center"><i>AI 视频笔记生成工具 让 AI 为你的视频做笔记</i></p>

View File

@@ -2,19 +2,18 @@ server {
listen 80;
client_max_body_size 10G;
# gzip 压缩
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;
# 所有非 /api 请求全部代理给 frontend 容器
# 多容器(docker-compose)部署:前端在独立的 frontend 容器,代理过去。
# 单镜像(Dockerfile.complete)部署请勿用本文件,改用 nginx/standalone.conf。
location / {
proxy_pass http://frontend:80;
}
# 所有 /api 请求代理给 backend 容器
location /api/ {
proxy_pass http://backend:8483;
proxy_set_header Host $host;

41
nginx/standalone.conf Normal file
View File

@@ -0,0 +1,41 @@
# 单镜像Dockerfile.complete / 一体化部署)专用 nginx 配置。
#
# 与 nginx/default.confdocker-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";
}
}