From a41f2db435ef620dff929189d72e1126aef47a2d Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Tue, 12 Dec 2023 15:05:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96nginx=E9=85=8D?= =?UTF-8?q?=E7=BD=AEserver=5Fname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 4 ++-- docker-entrypoint.sh | 7 +++++++ nginx.conf | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 6ead7b78..6a9c288b 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0-TEST . -docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0-TEST +docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0 . +docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-ui-vue:2.1.0 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c57efdd4..917ccab7 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,14 +1,21 @@ #!/usr/bin/env bash API_BASE_PATH=$API_BASE_PATH; +SERVER_NAME=$SERVER_NAME NAMESERVERS=$(cat /etc/resolv.conf | grep "nameserver" | awk '{print $2}' | tr '\n' ' ') if [ -z "$API_BASE_PATH" ]; then API_BASE_PATH="http://jetlinks:8844/"; fi +if [ -z "$SERVER_NAME" ]; then + SERVER_NAME="localhost"; +fi + apiUrl="proxy_pass $API_BASE_PATH\$1;" resolver="resolver $NAMESERVERS ipv6=off;" +serverName="server_name $SERVER_NAME;" +sed -i '4c '"$serverName"'' /etc/nginx/conf.d/default.conf sed -i '11c '"$resolver"'' /etc/nginx/conf.d/default.conf sed -i '20c '"$apiUrl"'' /etc/nginx/conf.d/default.conf diff --git a/nginx.conf b/nginx.conf index 92401367..47e6d6e0 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,7 +1,7 @@ server { listen 80; listen [::]:80; - # gzip config + server_name _; gzip on; gzip_min_length 1k; gzip_comp_level 9;