From 3ee6ba66581a4c7e1876799fa325edddca60cd48 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Mon, 4 Dec 2023 15:56:12 +0000 Subject: [PATCH] fix(deploy): Serve staticfiles in bare metal deployments Part-of: --- changes/changelog.d/2256.bugfix | 1 + deploy/nginx.template | 3 +++ templates/nginx.conf.j2 | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 changes/changelog.d/2256.bugfix diff --git a/changes/changelog.d/2256.bugfix b/changes/changelog.d/2256.bugfix new file mode 100644 index 000000000..9d9d2c5ea --- /dev/null +++ b/changes/changelog.d/2256.bugfix @@ -0,0 +1 @@ +Fix regression that prevent static files from being served in non-docker-deployments (#2256) diff --git a/deploy/nginx.template b/deploy/nginx.template index c77cb9335..d306f8af4 100644 --- a/deploy/nginx.template +++ b/deploy/nginx.template @@ -192,4 +192,7 @@ server { return 302 ${FUNKWHALE_PROTOCOL}://${FUNKWHALE_HOSTNAME}/api/v1/instance/spa-manifest.json; } + location /staticfiles/ { + alias ${STATIC_ROOT}/; + } } diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index ab8ea05d9..6dca6c1f4 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -261,5 +261,10 @@ server { alias /usr/share/nginx/html/staticfiles/; } {% endif %} +{% if not config.reverse_proxy and not config.inside_docker %} + location /staticfiles/ { + alias ${STATIC_ROOT}/; + } +{% endif %} {% endif %} }