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 = {