From 2d4a4dfe4c7395e8e1e658893f18d23f7a8a41f6 Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Sat, 21 Jun 2025 23:08:18 +0200 Subject: [PATCH] fix: locations --- hosts/hitsugibune/nextcloud.nix | 58 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/hosts/hitsugibune/nextcloud.nix b/hosts/hitsugibune/nextcloud.nix index 81eea05..3c598e0 100644 --- a/hosts/hitsugibune/nextcloud.nix +++ b/hosts/hitsugibune/nextcloud.nix @@ -40,34 +40,36 @@ }; virtualHosts."localhost" = { - "/nextcloud/" = { - priority = 9999; - extraConfig = '' - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-NginX-Proxy true; - proxy_set_header X-Forwarded-Proto http; - proxy_pass http://127.0.0.1:8080/; # tailing / is important! - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - proxy_redirect off; - ''; - }; - "^~ /.well-known" = { - priority = 9000; - extraConfig = '' - absolute_redirect off; - location ~ ^/\\.well-known/(?:carddav|caldav)$ { - return 301 /nextcloud/remote.php/dav; - } - location ~ ^/\\.well-known/host-meta(?:\\.json)?$ { - return 301 /nextcloud/public.php?service=host-meta-json; - } - location ~ ^/\\.well-known/(?!acme-challenge|pki-validation) { - return 301 /nextcloud/index.php$request_uri; - } - try_files $uri $uri/ =404; - ''; + locations = { + "/nextcloud" = { + priority = 9999; + extraConfig = '' + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_set_header X-Forwarded-Proto http; + proxy_pass http://127.0.0.1:8080/; # tailing / is important! + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_redirect off; + ''; + }; + "^~ /.well-known" = { + priority = 9000; + extraConfig = '' + absolute_redirect off; + location ~ ^/\\.well-known/(?:carddav|caldav)$ { + return 301 /nextcloud/remote.php/dav; + } + location ~ ^/\\.well-known/host-meta(?:\\.json)?$ { + return 301 /nextcloud/public.php?service=host-meta-json; + } + location ~ ^/\\.well-known/(?!acme-challenge|pki-validation) { + return 301 /nextcloud/index.php$request_uri; + } + try_files $uri $uri/ =404; + ''; + }; }; }; };