Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: support remote backend and HTTPS proxy

wizardchenbfab05972f95
diff --git a/.env.example b/.env.example
index f0eb63ab9..25c56c4d8 100644
--- a/.env.example
+++ b/.env.example
@@ -33,12 +33,22 @@ STORAGE_TYPE=local
# 流处理后端(memory/redis)
STREAM_MANAGER_TYPE=redis
-# 应用服务主机名,默认为app
+# 应用服务主机名,默认为app(Docker内部服务名)
+# 如需代理到远程后端,可设为远程地址,如 remote-app.example.com
APP_HOST=app
-# 应用服务端口,默认为8080
+# 应用服务宿主机映射端口,默认为8080(仅影响宿主机访问,不影响容器间通信)
APP_PORT=8080
+# NGINX 代理到后端的目标端口,默认为8080(App容器内部监听端口)
+# 本地部署:保持默认即可,无需随 APP_PORT 修改
+# 远程部署:设为远程 App 服务的实际端口
+# APP_BACKEND_PORT=8080
+
+# NGINX 代理到后端的协议,默认为http
+# 远程部署如后端为 HTTPS,需设为 https
+# APP_SCHEME=http
+
# 前端服务端口,默认为80
FRONTEND_PORT=80
diff --git a/docker-compose.yml b/docker-compose.yml
index 92f2520f2..178be97a3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,7 +11,13 @@ services:
environment:
- MAX_FILE_SIZE_MB=${MAX_FILE_SIZE_MB:-50}
- APP_HOST=${APP_HOST:-app}
- - APP_PORT=${APP_PORT:-8080}
+ # APP_BACKEND_PORT: the port NGINX proxies to (default 8080).
+ # For local deployment this is the App container's listening port, independent of host-mapped APP_PORT.
+ # For remote deployment, set this to the remote App's service port.
+ - APP_PORT=${APP_BACKEND_PORT:-8080}
+ - APP_SCHEME=${APP_SCHEME:-http}
+ # NOTE: If using a remote App backend, comment out or remove the depends_on
+ # block below and set APP_HOST/APP_BACKEND_PORT/APP_SCHEME in your .env file.
depends_on:
app:
condition: service_healthy
diff --git a/frontend/docker-entrypoint.sh b/frontend/docker-entrypoint.sh
index ff892d49e..f0a7bd414 100644
--- a/frontend/docker-entrypoint.sh
+++ b/frontend/docker-entrypoint.sh
@@ -11,7 +11,8 @@ EOF
export MAX_FILE_SIZE=${MAX_FILE_SIZE_MB}M
export APP_HOST=${APP_HOST:-app}
export APP_PORT=${APP_PORT:-8080}
-envsubst '${MAX_FILE_SIZE} ${APP_HOST} ${APP_PORT}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
+export APP_SCHEME=${APP_SCHEME:-http}
+envsubst '${MAX_FILE_SIZE} ${APP_HOST} ${APP_PORT} ${APP_SCHEME}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
# 启动 nginx
exec nginx -g 'daemon off;'
diff --git a/frontend/nginx.conf b/frontend/nginx.conf
index 269843073..a1678c8cf 100644
--- a/frontend/nginx.conf
+++ b/frontend/nginx.conf
@@ -22,8 +22,9 @@ server {
}
# API请求代理到后端服务
+ # APP_SCHEME 默认 http,远程 HTTPS 后端可设为 https
location /api/ {
- proxy_pass http://${APP_HOST}:${APP_PORT}/api/;
+ proxy_pass ${APP_SCHEME}://${APP_HOST}:${APP_PORT}/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;