You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
901 B
Bash
31 lines
901 B
Bash
#!/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
|
|
|
|
apiUrl="proxy_pass $API_BASE_PATH\$1;"
|
|
resolver="resolver $NAMESERVERS ipv6=off;"
|
|
|
|
sed -i '11c '"$resolver"'' /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;"
|
|
sed -i '4c '"$serverName"'' /etc/nginx/conf.d/default.conf
|
|
sed -i '15,17d' /etc/nginx/conf.d/default.conf
|
|
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
|
|
fi
|
|
|
|
#cat /etc/nginx/conf.d/default.conf
|
|
|
|
nginx -g "daemon off;"
|
|
|