From 5589bf60ab09e0f68005e286d01f271ba3058ea1 Mon Sep 17 00:00:00 2001 From: Adam French Date: Mon, 24 Nov 2025 14:13:10 +0000 Subject: [PATCH] adding icecast reverse proxy --- nginx/entrypoint.sh | 2 +- nginx/nginx.conf.template | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/nginx/entrypoint.sh b/nginx/entrypoint.sh index 8faaf52..6fe006c 100755 --- a/nginx/entrypoint.sh +++ b/nginx/entrypoint.sh @@ -4,7 +4,7 @@ set -e # Check if certificate exists if [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then echo "Certificates found. Using production nginx config." - envsubst '$BACKEND_HOST $BACKEND_PORT $DOMAIN' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf + envsubst '$BACKEND_HOST $BACKEND_PORT $DOMAIN $ICECAST_PORT $ICECAST_HOST' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf else echo "Certificates NOT found. Using setup nginx config." envsubst '$BACKEND_HOST $BACKEND_PORT $DOMAIN' < /etc/nginx/nginx_setup.conf.template > /etc/nginx/nginx.conf diff --git a/nginx/nginx.conf.template b/nginx/nginx.conf.template index 80f1cf4..12b369a 100644 --- a/nginx/nginx.conf.template +++ b/nginx/nginx.conf.template @@ -70,6 +70,18 @@ http { proxy_set_header X-Forwarded-Proto $scheme; } + location /radio { + return 301 /radio/; + } + + location /radio/ { + proxy_pass http://$ICECAST_HOST:$ICECAST_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; + proxy_set_header X-Forwarded-Proto $scheme; + } + } }