diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e13d49a..ccd7bf7 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,7 +1,12 @@ #!/bin/sh +# Default to HTTP if PROTOCOL is not set +PROTOCOL="${PROTOCOL:-http}" + +# Replace placeholders with environment variable values +envsubst '$BACKEND_ADDRESS $BACKEND_PORT $PROTOCOL' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf # Use envsubst to replace environment variables in nginx.conf.template and output to nginx.conf -envsubst '$BACKEND_ADDRESS,$BACKEND_PORT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf +#envsubst '$BACKEND_ADDRESS,$BACKEND_PORT' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf # Start nginx in the foreground exec nginx -g 'daemon off;' diff --git a/nginx.conf b/nginx.conf index 47f8ec1..b7e719e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -14,7 +14,8 @@ http { location / { # Use the placeholders for the proxy pass (these will be replaced by envsubst) - proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT; + proxy_pass ${PROTOCOL}://$BACKEND_ADDRESS:$BACKEND_PORT; +# proxy_pass http://$BACKEND_ADDRESS:$BACKEND_PORT; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/unifi.yml b/unifi.yml index c62fc83..30a2232 100644 --- a/unifi.yml +++ b/unifi.yml @@ -9,7 +9,7 @@ services: image: codeberg.org/iridium-net/lan-to-nginx:latest environment: - BACKEND_ADDRESS=192.168.8.1 - - BACKEND_PORT=80 + - BACKEND_PORT=443 networks: - traefik deploy: