diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index d8105355..20b852e4 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -8,7 +8,8 @@ echo -e "======================1. 检测配置文件========================\n" make_dir /etc/nginx/conf.d make_dir /run/nginx cp -fv $nginx_conf /etc/nginx/nginx.conf -envsubst '${qlBaseUrl}' < $nginx_app_conf > /etc/nginx/conf.d/front.conf +cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf +sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf pm2 l &>/dev/null echo diff --git a/docker/front.conf b/docker/front.conf index 368e83ab..46757715 100644 --- a/docker/front.conf +++ b/docker/front.conf @@ -16,14 +16,14 @@ server { root /ql/static/dist; ssl_session_timeout 5m; - location ${ql_base_url}api/public { + location QL_BASE_URL/api/public { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://publicApi/api/public/; } - location ${ql_base_url}api { + location QL_BASE_URL/api { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -33,7 +33,7 @@ server { proxy_set_header Connection $connection_upgrade; } - location ${ql_base_url}open { + location QL_BASE_URL/open { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -49,9 +49,9 @@ server { gzip_buffers 16 8k; gzip_http_version 1.0; - location ${ql_base_url} { + location QL_BASE_URL/ { index index.html index.htm; - try_files $uri $uri/ ${ql_base_url}index.html; + try_files $uri $uri/ QL_BASE_URL/index.html; } location ~ .*\.(html)$ { diff --git a/shell/check.sh b/shell/check.sh index 5b58b47f..b9ad458a 100644 --- a/shell/check.sh +++ b/shell/check.sh @@ -30,7 +30,8 @@ copy_dep() { echo -e "---> 2. 复制nginx配置文件\n" cp -fv $nginx_conf /etc/nginx/nginx.conf - envsubst '${qlBaseUrl}' < $nginx_app_conf > /etc/nginx/conf.d/front.conf + cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf + sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf echo -e "---> 配置文件复制完成\n" } diff --git a/shell/share.sh b/shell/share.sh index b44df92b..d29f4cc8 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -67,7 +67,7 @@ import_config() { [[ -f $file_config_user ]] && . $file_config_user [[ -f $file_env ]] && . $file_env - ql_base_url=${QlBaseUrl:-"/"} + ql_base_url=${QlBaseUrl:-""} command_timeout_time=${CommandTimeoutTime:-"1h"} proxy_url=${ProxyUrl:-""} file_extensions=${RepoFileExtensions:-"js py"}