adding endpoint reference
This commit is contained in:
@@ -4,7 +4,7 @@ set -e
|
|||||||
# Check if certificate exists
|
# Check if certificate exists
|
||||||
if [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then
|
if [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then
|
||||||
echo "Certificates found. Using production nginx config."
|
echo "Certificates found. Using production nginx config."
|
||||||
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${ICECAST_HOST} ${ICECAST_PORT}' \
|
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT}' \
|
||||||
< /etc/nginx/nginx.conf.template \
|
< /etc/nginx/nginx.conf.template \
|
||||||
> /etc/nginx/nginx.conf
|
> /etc/nginx/nginx.conf
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ http {
|
|||||||
root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /api {
|
location = $BACKEND_ENDPOINT {
|
||||||
return 301 /api/;
|
return 301 $BACKEND_ENDPOINT/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/ {
|
location $BACKEND_ENDPOINT/ {
|
||||||
rewrite ^/api/(.*)$ /$1 break;
|
rewrite ^$BACKEND_ENDPOINT/(.*)$ /$1 break;
|
||||||
proxy_pass http://$BACKEND_HOST:$BACKEND_PORT/;
|
proxy_pass http://$BACKEND_HOST:$BACKEND_PORT/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
Reference in New Issue
Block a user