From f9874296ae3b06a744633cc1632f63d29b6724a1 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 17 Oct 2025 11:47:04 -0300 Subject: [PATCH] expose nextcloud and collabora on proxy --- hosts/alexandria/nextcloud.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/hosts/alexandria/nextcloud.nix b/hosts/alexandria/nextcloud.nix index 84853dc..373b0e5 100644 --- a/hosts/alexandria/nextcloud.nix +++ b/hosts/alexandria/nextcloud.nix @@ -2,9 +2,15 @@ lib, config, pkgs, + inputs, ... }: +let + utils = import ../../utils.nix { inherit inputs lib; }; + inherit (utils) mkNginxVHosts; +in + { services = { nextcloud = { @@ -62,17 +68,35 @@ collabora-online = { enable = true; + port = 9980; settings = { ssl = { enable = false; termination = true; }; net = { - listen = "unix"; + listen = "loopback"; frame_ancestors = "cloud.baduhai.dev"; }; }; }; + + nginx.virtualHosts = mkNginxVHosts { + acmeHost = "baduhai.dev"; + domains = { + "cloud.baduhai.dev" = { }; + "office.baduhai.dev".locations = { + "/".proxyPass = "http://127.0.0.1:${toString config.services.collabora-online.port}"; + "~ ^/cool/(.*)/ws$".proxyPass = "http://127.0.0.1:${toString config.services.collabora-online.port}"; + "~ ^/cool/(.*)/ws$".extraConfig = '' + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_read_timeout 36000s; + ''; + }; + }; + }; }; age.secrets = {