server {
    listen       8080;
    server_name  localhost;
    root /usr/share/nginx/html;

    rewrite           ^([^.]*[^/])$ $1/ permanent;
    absolute_redirect off;

    location ${BASE_PATH} {
        set $EVAL_BASE_PATH "${BASE_PATH}";
        if ($EVAL_BASE_PATH = "/") {
            root   /usr/share/nginx/html;
        }
        index  index.html index.htm;
        alias  /usr/share/nginx/html;
    }

    location ~ /app.config.json {
        alias  ${NGINX_ENVSUBST_OUTPUT_DIR}/app.config.json;
    }

    location ~ /assets/app.extensions.json {
        alias  ${NGINX_ENVSUBST_OUTPUT_DIR}/app.extensions.json;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}
