diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1b05fc13..584939e0 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -8,12 +8,11 @@ if [ -z "$API_BASE_PATH" ]; then API_BASE_PATH="http://jetlinks:8844/"; fi - apiUrl="proxy_pass $API_BASE_PATH\$1;" resolver="resolver $NAMESERVERS ipv6=off;" sed -i '11c '"$resolver"'' /etc/nginx/conf.d/default.conf -sed -i '25c '"$apiUrl"'' /etc/nginx/conf.d/default.conf +sed -i "s%{API_BASE_PATH}%$API_BASE_PATH%g" /etc/nginx/conf.d/default.conf if [ -z "$SERVER_NAME" ]; then serverName="server_name localhost;" @@ -22,8 +21,10 @@ if [ -z "$SERVER_NAME" ]; then else serverName="server_name $SERVER_NAME;" sed -i '4c '"$serverName"'' /etc/nginx/conf.d/default.conf - sed -i 's/\${SERVER_NAME}/'$SERVER_NAME'/g' /etc/nginx/conf.d/default.conf + sed -i "s%{SERVER_NAME}%$SERVER_NAME%g" /etc/nginx/conf.d/default.conf fi +#cat /etc/nginx/conf.d/default.conf + nginx -g "daemon off;" diff --git a/nginx.conf b/nginx.conf index 7ef39652..0748177a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -12,7 +12,7 @@ server { root /usr/share/nginx/html; include /etc/nginx/mime.types; - if ($http_Host !~* ^${SERVER_NAME}) { + if ($http_Host !~* ^{SERVER_NAME}) { return 403; } @@ -22,7 +22,7 @@ server { location ^~/api/ { if ($request_uri ~* ^/api/(.*)$) { - proxy_pass http://host.docker.internal:8840/$1; + proxy_pass {API_BASE_PATH}$1; } #proxy_pass http://host.docker.internal:8840/; proxy_set_header X-Forwarded-Proto $scheme;