@@ -554,36 +554,40 @@ in {
554554 '';
555555 };
556556 "/" = {
557− priority = 200;
558− extraConfig = "rewrite ^ /index.php;";
557+ priority = 900;
558+ extraConfig = "try_files $uri $uri/ /index.php$request_uri;";
559559 };
560560 "~ ^/store-apps" = {
561561 priority = 201;
562562 extraConfig = "root ${cfg.home};";
563563 };
564− "= /.well-known/carddav" = {
564+ "^~ /.well-known" = {
565565 priority = 210;
566− extraConfig = "return 301 $scheme://$host/remote.php/dav;";
567− };
568− "= /.well-known/caldav" = {
569− priority = 210;
570− extraConfig = "return 301 $scheme://$host/remote.php/dav;";
571− };
572− "~ ^\\/(?:build|tests|config|lib|3rdparty|templates|data)\\/" = {
573− priority = 300;
574− extraConfig = "deny all;";
575− };
576− "~ ^\\/(?:\\.|autotest|occ|issue|indie|db_|console)" = {
577− priority = 300;
578− extraConfig = "deny all;";
566+ extraConfig = ''
567+ location = /.well-known/carddav {
568+ return 301 $scheme://$host/remote.php/dav;
569+ }
570+ location = /.well-known/caldav {
571+ return 301 $scheme://$host/remote.php/dav;
572+ }
573+ try_files $uri $uri/ =404;
574+ '';
579575 };
580− "~ ^\\/(?:index|remote|public|cron|core/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|ocm-provider\\/.+)\\.php(?:$|\\/)" = {
576+ "~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)".extraConfig = ''
577+ return 404;
578+ '';
579+ "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
580+ return 404;
581+ '';
582+ "~ \\.php(?:$|/)" = {
581583 priority = 500;
582584 extraConfig = ''
583585 include ${config.services.nginx.package}/conf/fastcgi.conf;
584− fastcgi_split_path_info ^(.+\.php)(\\/.*)$;
586+ fastcgi_split_path_info ^(.+?\.php)(\\/.*)$;
587+ set $path_info $fastcgi_path_info;
585588 try_files $fastcgi_script_name =404;
586− fastcgi_param PATH_INFO $fastcgi_path_info;
589+ fastcgi_param PATH_INFO $path_info;
590+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
587591 fastcgi_param HTTPS ${if cfg.https then "on" else "off"};
588592 fastcgi_param modHeadersAvailable true;
589593 fastcgi_param front_controller_active true;
@@ -593,28 +597,24 @@ in {
593597 fastcgi_read_timeout 120s;
594598 '';
595599 };
596− "~ ^\\/(?:updater|ocs-provider|ocm-provider)(?:$|\\/)".extraConfig = ''
597− try_files $uri/ =404;
598− index index.php;
599− '';
600− "~ \\.(?:css|js|woff2?|svg|gif)$".extraConfig = ''
600+ "~ \\.(?:css|js|svg|gif|map)$".extraConfig = ''
601601 try_files $uri /index.php$request_uri;
602− add_header Cache-Control "public, max-age=15778463";
603− add_header X-Content-Type-Options nosniff;
604− add_header X-XSS-Protection "1; mode=block";
605− add_header X-Robots-Tag none;
606− add_header X-Download-Options noopen;
607− add_header X-Permitted-Cross-Domain-Policies none;
608− add_header X-Frame-Options sameorigin;
609− add_header Referrer-Policy no-referrer;
602+ expires 6M;
610603 access_log off;
611604 '';
612− "~ \\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$".extraConfig = ''
605+ "~ \\.woff2?$".extraConfig = ''
613606 try_files $uri /index.php$request_uri;
607+ expires 7d;
614608 access_log off;
615609 '';
610+ "~ ^\\/(?:updater|ocs-provider|ocm-provider)(?:$|\\/)".extraConfig = ''
611+ try_files $uri/ =404;
612+ index index.php;
613+ '';
616614 };
617615 extraConfig = ''
616+ index index.php index.html /index.php$request_uri;
617+ expires 1m;
618618 add_header X-Content-Type-Options nosniff;
619619 add_header X-XSS-Protection "1; mode=block";
620620 add_header X-Robots-Tag none;
@@ -623,8 +623,6 @@ in {
623623 add_header X-Frame-Options sameorigin;
624624 add_header Referrer-Policy no-referrer;
625625 add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
626− error_page 403 /core/templates/403.php;
627− error_page 404 /core/templates/404.php;
628626 client_max_body_size ${cfg.maxUploadSize};
629627 fastcgi_buffers 64 4K;
630628 fastcgi_hide_header X-Powered-By;