[mod] added upstream port customization
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# domains are seperated with \n
|
||||
DOMAINS=example.com www api test
|
||||
# server values are seperated with ' ' (space) (one server per domain)
|
||||
SERVER=web
|
||||
# port can be appended, default is 8080 if ommited
|
||||
SERVER=web:8080
|
||||
|
||||
@@ -138,6 +138,10 @@ function gen_server_config()
|
||||
local domain_count=0
|
||||
local domains="$root_domain"
|
||||
|
||||
# default to 8080 if server port is undefined
|
||||
local port=":8080";
|
||||
[[ $server == *":"* ]] && port=""
|
||||
|
||||
# no arrays in dash
|
||||
local subdomain=$(get_element $domain_count " " $domain_list)
|
||||
while [ ${#subdomain} -gt 0 ]; do
|
||||
@@ -167,7 +171,7 @@ function gen_server_config()
|
||||
# allow for upstream to be offline by setting
|
||||
# docker dns resolver and a variable for the server
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
proxy_pass http://\$upstream:8080;
|
||||
proxy_pass http://\$upstream$port;
|
||||
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host \$host;
|
||||
|
||||
Reference in New Issue
Block a user