feat: support remote backend and HTTPS proxy

This commit is contained in:
wizardchen
2026-02-09 17:27:21 +08:00
committed by lyingbug
parent d72f65bc23
commit bfab05972f
4 changed files with 23 additions and 5 deletions
+2 -1
View File
@@ -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;'
+2 -1
View File
@@ -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;