git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/nextcloud: update nginx config for `nextcloud20`

See #97666 for further context.

commit227ba90b28b696988a6e44cbd01249a63244165d authorMaximilian Bosch <maximilian@mbosch.me> dateSun 4 Oct 2020, 23:50 (6 years ago) parent5f67a62
1 file changed+7−5
nixos/modules/services/web-apps/nextcloud.nix+7−5
nixos/modules/services/web-apps/nextcloud.nix+7−5
@@ -535,9 +535,9 @@ in {
535535
536536 services.nginx.enable = mkDefault true;
537537
538− # FIXME(ma27) make sure that the config works fine with Nextcloud 19
539− # *and* Nextcloud 20 as soon as it gets released.
540− services.nginx.virtualHosts.${cfg.hostName} = {
538+ services.nginx.virtualHosts.${cfg.hostName} = let
539+ major = toInt (versions.major cfg.package.version);
540+ in {
541541 root = cfg.package;
542542 locations = {
543543 "= /robots.txt" = {
@@ -550,7 +550,9 @@ in {
550550 };
551551 "/" = {
552552 priority = 900;
553− extraConfig = "rewrite ^ /index.php;";
553+ extraConfig = if major < 20
554+ then "rewrite ^ /index.php;"
555+ else "try_files $uri $uri/ /index.php$request_uri;";
554556 };
555557 "~ ^/store-apps" = {
556558 priority = 201;
@@ -574,7 +576,7 @@ in {
574576 "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
575577 return 404;
576578 '';
577− "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" = {
579+ ${if major < 20 then "~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[ms]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)" else "~ \\.php(?:$|/)"} = {
578580 priority = 500;
579581 extraConfig = ''
580582 include ${config.services.nginx.package}/conf/fastcgi.conf;