From 5406eb1daa49a11f63d07351e3638237658adc04 Mon Sep 17 00:00:00 2001 From: gyurix Date: Thu, 1 Jul 2021 08:47:24 +0000 Subject: [PATCH] Minor fixes in ngnix config create. --- scripts/nginx_config_create.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/nginx_config_create.sh b/scripts/nginx_config_create.sh index 0fa9434..de80401 100755 --- a/scripts/nginx_config_create.sh +++ b/scripts/nginx_config_create.sh @@ -62,10 +62,10 @@ location = /$ERROR_PAGE { fi echo "location / {" - if [ $HTTP_PORT == "" ]; then - echo "proxy_pass http://$LOCAL_IP:80;" - else + if [[ $HTTP_PORT != "" ]]; then echo "proxy_pass http://$LOCAL_IP:$HTTP_PORT;" + else + echo "proxy_pass http://$LOCAL_IP:80;" fi echo "proxy_redirect off; @@ -79,10 +79,11 @@ location = /$ERROR_PAGE { fi if [[ $HTTPS_PORT == "" ]] ; then - echo "}" + echo "} +}" fi -if [ $HTTPS_PORT != "" ]; then +if [[ $HTTPS_PORT != "" ]]; then echo "server { listen $HTTPS_PORT ssl; server_name $DOMAIN_NAME; @@ -113,10 +114,11 @@ location = /$ERROR_PAGE { fi echo "location / {" - if [ $HTTP_PORT == "" ]; then - echo "proxy_pass http://$LOCAL_IP:80;" - else + + if [[ $HTTP_PORT != "" ]]; then echo "proxy_pass http://$LOCAL_IP:$HTTP_PORT;" + else + echo "proxy_pass http://$LOCAL_IP:80;" fi echo "proxy_redirect off; @@ -127,6 +129,7 @@ echo "proxy_redirect off; proxy_cookie_path / /; access_log off; } +} }" fi