summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/nextcloud.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2020-09-10 16:49:23 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2020-09-10 16:50:36 +0200
commit8d8871c565373a46792fc0e4d3976a3c2ac58c18 (patch)
tree4f47dad8b8c29eb51529fb6e9be2107cfa1ec5b5 /nixos/modules/services/web-apps/nextcloud.nix
parent1d60af77224f25a0c428b21a34463ed1719caa27 (diff)
downloadnixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar.gz
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar.bz2
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar.lz
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar.xz
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.tar.zst
nixpkgs-8d8871c565373a46792fc0e4d3976a3c2ac58c18.zip
nixos/nextcloud: fix `nginx`-config for Nextcloud 19 and older
It seems as I misconfigured `nginx` for certain cases such as the
`ldap`-plugin[1] in 42f6244899d1ef8839c6e0c0a9340e1334d40264. This patch
fixes the `nginx`-config to match the upstream recommendations[2].

Also added a comment to the module to remind myself to ensure that
`nginx` will work with both v19 and v20 as soon as the latter is
released and can be packaged in `nixpkgs`.

Co-authored-by: nivadis <nivadis@users.noreply.github.com>

[1] https://github.com/nextcloud/server/issues/16194#issuecomment-688839888
[2] https://docs.nextcloud.com/server/19/admin_manual/installation/nginx.html
Diffstat (limited to 'nixos/modules/services/web-apps/nextcloud.nix')
-rw-r--r--nixos/modules/services/web-apps/nextcloud.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index 7da119758fc..a1127de4cd2 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -542,6 +542,9 @@ in {
       environment.systemPackages = [ occ ];
 
       services.nginx.enable = mkDefault true;
+
+      # FIXME(ma27) make sure that the config works fine with Nextcloud 19
+      # *and* Nextcloud 20 as soon as it gets released.
       services.nginx.virtualHosts.${cfg.hostName} = {
         root = cfg.package;
         locations = {
@@ -555,7 +558,7 @@ in {
           };
           "/" = {
             priority = 900;
-            extraConfig = "try_files $uri $uri/ /index.php$request_uri;";
+            extraConfig = "rewrite ^ /index.php;";
           };
           "~ ^/store-apps" = {
             priority = 201;
@@ -579,7 +582,7 @@ in {
           "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
             return 404;
           '';
-          "~ \\.php(?:$|/)" = {
+          "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" = {
             priority = 500;
             extraConfig = ''
               include ${config.services.nginx.package}/conf/fastcgi.conf;