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; + } + } }