@@ -544,36 +544,40 @@ in {
544544 '';
545545 };
546546 "/" = {
547− priority = 200;
548− extraConfig = "rewrite ^ /index.php;";
547+ priority = 900;
548+ extraConfig = "try_files $uri $uri/ /index.php$request_uri;";
549549 };
550550 "~ ^/store-apps" = {
551551 priority = 201;
552552 extraConfig = "root ${cfg.home};";
553553 };
554− "= /.well-known/carddav" = {
554+ "^~ /.well-known" = {
555555 priority = 210;
556− extraConfig = "return 301 $scheme://$host/remote.php/dav;";
557− };
558− "= /.well-known/caldav" = {
559− priority = 210;
560− extraConfig = "return 301 $scheme://$host/remote.php/dav;";
561− };
562− "~ ^\\/(?:build|tests|config|lib|3rdparty|templates|data)\\/" = {
563− priority = 300;
564− extraConfig = "deny all;";
565− };
566− "~ ^\\/(?:\\.|autotest|occ|issue|indie|db_|console)" = {
567− priority = 300;
568− extraConfig = "deny all;";
556+ extraConfig = ''
557+ location = /.well-known/carddav {
558+ return 301 $scheme://$host/remote.php/dav;
559+ }
560+ location = /.well-known/caldav {
561+ return 301 $scheme://$host/remote.php/dav;
562+ }
563+ try_files $uri $uri/ =404;
564+ '';
569565 };
570− "~ ^\\/(?:index|remote|public|cron|core/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|ocs-provider\\/.+|ocm-provider\\/.+)\\.php(?:$|\\/)" = {
566+ "~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)".extraConfig = ''
567+ return 404;
568+ '';
569+ "~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)".extraConfig = ''
570+ return 404;
571+ '';
572+ "~ \\.php(?:$|/)" = {
571573 priority = 500;
572574 extraConfig = ''
573575 include ${config.services.nginx.package}/conf/fastcgi.conf;
574− fastcgi_split_path_info ^(.+\.php)(\\/.*)$;
576+ fastcgi_split_path_info ^(.+?\.php)(\\/.*)$;
577+ set $path_info $fastcgi_path_info;
575578 try_files $fastcgi_script_name =404;
576− fastcgi_param PATH_INFO $fastcgi_path_info;
579+ fastcgi_param PATH_INFO $path_info;
580+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
577581 fastcgi_param HTTPS ${if cfg.https then "on" else "off"};
578582 fastcgi_param modHeadersAvailable true;
579583 fastcgi_param front_controller_active true;
@@ -583,28 +587,24 @@ in {
583587 fastcgi_read_timeout 120s;
584588 '';
585589 };
586− "~ ^\\/(?:updater|ocs-provider|ocm-provider)(?:$|\\/)".extraConfig = ''
587− try_files $uri/ =404;
588− index index.php;
589− '';
590− "~ \\.(?:css|js|woff2?|svg|gif)$".extraConfig = ''
590+ "~ \\.(?:css|js|svg|gif|map)$".extraConfig = ''
591591 try_files $uri /index.php$request_uri;
592− add_header Cache-Control "public, max-age=15778463";
593− add_header X-Content-Type-Options nosniff;
594− add_header X-XSS-Protection "1; mode=block";
595− add_header X-Robots-Tag none;
596− add_header X-Download-Options noopen;
597− add_header X-Permitted-Cross-Domain-Policies none;
598− add_header X-Frame-Options sameorigin;
599− add_header Referrer-Policy no-referrer;
592+ expires 6M;
600593 access_log off;
601594 '';
602− "~ \\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$".extraConfig = ''
595+ "~ \\.woff2?$".extraConfig = ''
603596 try_files $uri /index.php$request_uri;
597+ expires 7d;
604598 access_log off;
605599 '';
600+ "~ ^\\/(?:updater|ocs-provider|ocm-provider)(?:$|\\/)".extraConfig = ''
601+ try_files $uri/ =404;
602+ index index.php;
603+ '';
606604 };
607605 extraConfig = ''
606+ index index.php index.html /index.php$request_uri;
607+ expires 1m;
608608 add_header X-Content-Type-Options nosniff;
609609 add_header X-XSS-Protection "1; mode=block";
610610 add_header X-Robots-Tag none;
@@ -613,8 +613,6 @@ in {
613613 add_header X-Frame-Options sameorigin;
614614 add_header Referrer-Policy no-referrer;
615615 add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
616− error_page 403 /core/templates/403.php;
617− error_page 404 /core/templates/404.php;
618616 client_max_body_size ${cfg.maxUploadSize};
619617 fastcgi_buffers 64 4K;
620618 fastcgi_hide_header X-Powered-By;