From 6157df55520c1caf1b887a3af45e3f01544083ce Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Thu, 23 Nov 2023 12:55:52 +0000 Subject: [PATCH] fix(nginx): Fix docker nginx configurations --- docker/nginx/conf.dev | 3 +-- front/docker/funkwhale.conf.template | 3 +-- templates/nginx.conf.j2 | 17 ++++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docker/nginx/conf.dev b/docker/nginx/conf.dev index aecf2688d..931d47d35 100644 --- a/docker/nginx/conf.dev +++ b/docker/nginx/conf.dev @@ -1,7 +1,6 @@ - upstream funkwhale-api { # depending on your setup, you may want to update this - server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}; + server ${FUNKWHALE_API_HOST}:${FUNKWHALE_API_PORT}; } upstream funkwhale-front { diff --git a/front/docker/funkwhale.conf.template b/front/docker/funkwhale.conf.template index abbf636d5..144cd3ae5 100644 --- a/front/docker/funkwhale.conf.template +++ b/front/docker/funkwhale.conf.template @@ -1,7 +1,6 @@ - upstream funkwhale-api { # depending on your setup, you may want to update this - server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}; + server ${FUNKWHALE_API_HOST}:${FUNKWHALE_API_PORT}; } # Required for websocket support. diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 8b88ced42..4822eae31 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -3,12 +3,19 @@ upstream fw { server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}; } {% else %} +{% if config.inside_docker %} +upstream funkwhale-api { + # depending on your setup, you may want to update this + server ${FUNKWHALE_API_HOST}:${FUNKWHALE_API_PORT}; +} +{% else %} upstream funkwhale-api { # depending on your setup, you may want to update this server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}; } {% endif %} +{% endif %} {% if config.proxy_frontend %} upstream funkwhale-front { @@ -68,7 +75,7 @@ server { listen [::]:80; server_name _; - +PI_IP}:${FUNKWHALE_API_PORT}; {% endif %} # General configs @@ -76,7 +83,7 @@ server { {% if config.inside_docker %} root /usr/share/nginx/html; {% else %} - root ${FUNKWHALE_FRONTEND_PATH}, + root ${FUNKWHALE_FRONTEND_PATH}; {% endif %} {% endif %} client_max_body_size ${NGINX_MAX_BODY_SIZE}; @@ -130,12 +137,12 @@ server { {% if config.proxy_frontend and not config.reverse_proxy %} proxy_pass http://funkwhale-front; {% elif not config.proxy_frontend and config.reverse_proxy %} - proxy_pass http://fw + proxy_pass http://fw; {% else %} {% if config.inside_docker %} alias /usr/share/nginx/html/; {% else %} - alias ${FUNKWHALE_FRONTEND_PATH}/, + alias ${FUNKWHALE_FRONTEND_PATH}/; {% endif %} try_files $uri $uri/ /index.html; {% endif %} @@ -150,7 +157,7 @@ server { {% if config.inside_docker %} alias /usr/share/nginx/html/embed.html; {% else %} - alias ${FUNKWHALE_FRONTEND_PATH}/embed.html, + alias ${FUNKWHALE_FRONTEND_PATH}/embed.html; {% endif %} {% endif %} add_header Content-Security-Policy "connect-src https: http: 'self'; default-src 'self'; script-src 'self' unpkg.com 'unsafe-inline' 'unsafe-eval'; style-src https: http: 'self' 'unsafe-inline'; img-src https: http: 'self' data:; font-src https: http: 'self' data:; object-src 'none'; media-src https: http: 'self' data:";