diff --git a/nginx/https.template b/nginx/https.template index 80420e7..1f26232 100644 --- a/nginx/https.template +++ b/nginx/https.template @@ -36,7 +36,7 @@ server { location /upload/ { client_max_body_size 16M; - proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}; + proxy_pass http://${SNIKKET_TWEAK_INTERNAL_HTTP_HOST}:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; diff --git a/nginx/snikket-common.template b/nginx/snikket-common.template index 9b22e2f..558a97b 100644 --- a/nginx/snikket-common.template +++ b/nginx/snikket-common.template @@ -29,14 +29,14 @@ location /upload { } location @portal { - proxy_pass http://localhost:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT}; + proxy_pass http://${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST}:${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT}; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; } location @prosody { - proxy_pass http://localhost:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}; + proxy_pass http://${SNIKKET_TWEAK_INTERNAL_HTTP_HOST}:${SNIKKET_TWEAK_INTERNAL_HTTP_PORT}; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; diff --git a/render-template.sh b/render-template.sh index 1c1a72b..76c8efd 100755 --- a/render-template.sh +++ b/render-template.sh @@ -1,10 +1,17 @@ #!/bin/bash -export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80} -export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443} +# Prosody host/port +export SNIKKET_TWEAK_INTERNAL_HTTP_HOST=${SNIKKET_TWEAK_INTERNAL_HTTP_HOST-localhost} export SNIKKET_TWEAK_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_INTERNAL_HTTP_PORT-5280} + +# Portal host/port +export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST-localhost} export SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT=${SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT-5765} -exec envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT' \ +# External ports +export SNIKKET_TWEAK_HTTP_PORT=${SNIKKET_TWEAK_HTTP_PORT-80} +export SNIKKET_TWEAK_HTTPS_PORT=${SNIKKET_TWEAK_HTTPS_PORT-443} + +exec envsubst '$SNIKKET_DOMAIN $SNIKKET_TWEAK_HTTP_PORT $SNIKKET_TWEAK_HTTPS_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_PORT $SNIKKET_TWEAK_INTERNAL_HTTP_HOST $SNIKKET_TWEAK_PORTAL_INTERNAL_HTTP_HOST' \ < "$1" \ > "$2";