diff --git a/files/domains.env b/files/domains.env index 6bc2b67..05a8ef8 100644 --- a/files/domains.env +++ b/files/domains.env @@ -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 diff --git a/proxy/files/entrypoint.sh b/proxy/files/entrypoint.sh index 041b244..0405ed2 100644 --- a/proxy/files/entrypoint.sh +++ b/proxy/files/entrypoint.sh @@ -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; @@ -299,4 +303,4 @@ function main() nginx_handler } -main $@ \ No newline at end of file +main $@