feat: support remote backend and HTTPS proxy
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user