I also have this issue when switch the web server from apache only to nginx only.
it only work apache only or Apache & nginx or Apache&nginx&varnish
tried: uninstall Mod_security, re-generate Vhost, Fix permissions from GUI.
logs.
[i][i][i]2023/08/14 18:39:45 [error] 4784#4784: *65 openat() "/home/weasam/nextcloud.domain.com/index.php/apps/files/preview-service-worker.js" failed (20: Not a directory), client: 192.168.10.1, server: nextcloud.domain.com, request: "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1", host: "nextcloud.domain.com", referrer: "https://nextcloud.domain.com/index.php/apps/files/preview-service-worker.js"
2023/08/14 18:40:12 [error] 5206#5206: *70 openat() "/home/weasam/nextcloud.domain.com/index.php/apps/files/preview-service-worker.js" failed (20: Not a directory), client: 192.168.10.1, server: nextcloud.domain.com, request: "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1", host: "nextcloud.domain.com", referrer: "https://nextcloud.domain.com/index.php/apps/files/preview-service-worker.js"
2023/08/14 18:40:21 [error] 5330#5330: *71 openat() "/home/weasam/nextcloud.domain.com/index.php/apps/files/preview-service-worker.js" failed (20: Not a directory), client: 192.168.10.1, server: nextcloud.domain.com, request: "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1", host: "nextcloud.domain.com", referrer: "https://nextcloud.domain.com/index.php/apps/files/preview-service-worker.js"
2023/08/14 18:40:34 [error] 5551#5551: *73 openat() "/home/weasam/nextcloud.domain.com/index.php/apps/files/preview-service-worker.js" failed (20: Not a directory), client: 192.168.10.1, server: nextcloud.domain.com, request: "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1", host: "nextcloud.domain.com", referrer: "https://nextcloud.domain.com/index.php/apps/files/preview-service-worker.js"
2023/08/14 18:40:42 [error] 5663#5663: *74 openat() "/home/weasam/nextcloud.domain.com/index.php/apps/files/preview-service-worker.js" failed (20: Not a directory), client: 192.168.10.1, server: nextcloud.domain.com, request: "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1", host: "nextcloud.domain.com", referrer: "https://nextcloud.domain.com/index.php/apps/files/preview-service-worker.js"[/i][/i][/i]
From the log it says is missing file /apps/files/preview-service-worker.js. when I go to file manager , it's confirmed missing this file.
but why would it work when switchted to apache webserver. I will regenerate this issue from new Nextcloud installation