From 07f152cb204871d85645e3c1b33fe375259ed5d3 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Fri, 5 Mar 2021 16:12:25 +0100 Subject: [PATCH] fuuko: Add media file index --- machines/fuuko/configuration.nix | 1 + machines/fuuko/services/media.nix | 14 ++++++++++++++ modules/media-proxy.nix | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 machines/fuuko/services/media.nix diff --git a/machines/fuuko/configuration.nix b/machines/fuuko/configuration.nix index 5ce4f3f..5c6203f 100644 --- a/machines/fuuko/configuration.nix +++ b/machines/fuuko/configuration.nix @@ -6,6 +6,7 @@ ../../users/simon ./services/grafana.nix + ./services/media.nix ./services/prometheus.nix ./services/scan.nix ]; diff --git a/machines/fuuko/services/media.nix b/machines/fuuko/services/media.nix new file mode 100644 index 0000000..18c34ed --- /dev/null +++ b/machines/fuuko/services/media.nix @@ -0,0 +1,14 @@ +{ + services.nginx.virtualHosts."media.sbruder.de" = { + enableACME = true; + forceSSL = true; + + basicAuthFile = "/data/media/.htpasswd"; + + root = "/data/media/"; + + locations."=/.htpasswd".return = "403"; + }; + + services.nginx-interactive-index.virtualHosts."media.sbruder.de".locations."/".enable = true; +} diff --git a/modules/media-proxy.nix b/modules/media-proxy.nix index c6e0699..591ba11 100644 --- a/modules/media-proxy.nix +++ b/modules/media-proxy.nix @@ -26,7 +26,7 @@ in ]; locations = { "/".extraConfig = '' - rewrite ^/__assets/(.*)$ /media/__assets/$1; + rewrite ^/__nginx-interactive-index-assets__/(.*)$ /media/__nginx-interactive-index-assets__/$1; ''; } // lib.mapAttrs' (name: secret: {