From d1c7267119efd4092e90fe35158eb7394663d9c3 Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 14 Aug 2022 21:04:21 +0200 Subject: [PATCH] storage-2: Add directory listing service with DAV file upload --- hosts/storage-2/configuration.nix | 1 + hosts/storage-2/filemanager/index.html | 321 +++++++++++++++++++++++++ hosts/storage-2/storage.nix | 38 +++ 3 files changed, 360 insertions(+) create mode 100644 hosts/storage-2/filemanager/index.html create mode 100644 hosts/storage-2/storage.nix diff --git a/hosts/storage-2/configuration.nix b/hosts/storage-2/configuration.nix index 899aeff..32bcac3 100644 --- a/hosts/storage-2/configuration.nix +++ b/hosts/storage-2/configuration.nix @@ -7,6 +7,7 @@ ../../configuration/common ../../configuration/proxmox-vm ./mixcloud.nix + ./storage.nix ]; boot.loader.grub.enable = true; diff --git a/hosts/storage-2/filemanager/index.html b/hosts/storage-2/filemanager/index.html new file mode 100644 index 0000000..ce52a0b --- /dev/null +++ b/hosts/storage-2/filemanager/index.html @@ -0,0 +1,321 @@ + + + + + + storage.clerie.de + + + + +
+
+

+
+ +
+
+
+
+ + + diff --git a/hosts/storage-2/storage.nix b/hosts/storage-2/storage.nix new file mode 100644 index 0000000..334cb9c --- /dev/null +++ b/hosts/storage-2/storage.nix @@ -0,0 +1,38 @@ +{ ... }: + +{ + services.nginx.virtualHosts = { + "storage.clerie.de" = { + enableACME = true; + forceSSL = true; + + basicAuthFile = "/var/src/secrets/nginx/storage.htpasswd"; + + locations."= /" = { + alias = "${./filemanager}/"; + extraConfig = '' + try_files index.html =404; + ''; + }; + + locations."/_/" = { + alias = "/data/"; + extraConfig = '' + autoindex on; + autoindex_format json; + + client_body_temp_path /data; + dav_methods PUT DELETE MKCOL COPY MOVE; + create_full_put_path on; + dav_access group:rw all:r; + client_max_body_size 1G; + ''; + }; + }; + }; + + systemd.services.nginx.serviceConfig = { + ReadWritePaths = "/data"; + }; +} +