Unable to configure nginx with php-fpm

I have a problem with my php-fpm + nginx config:

  services.phpfpm.pools.pool = {
    user = "nobody";
    settings = {
      pm = "dynamic";
      "listen.owner" = config.services.nginx.user;
      "pm.max_children" = 5;
      "pm.start_servers" = 2;
      "pm.min_spare_servers" = 1;
      "pm.max_spare_servers" = 3;
      "pm.max_requests" = 500;
    };
  };

  services.nginx = {
    enable = true;
    recommendedOptimisation = true;
    recommendedProxySettings = true;
    clientMaxBodySize = "100M";
    package = pkgs.nginxQuic;

    virtualHosts."domain.it" = {
      root = "/var/www/domain.it";
      forceSSL = true;
      sslCertificate = "/var/lib/acme/domain.it/cert.pem";
      sslCertificateKey = "/var/lib/acme/domain.it/key.pem";
      http3 = true;

      locations."/".extraConfig = ''
        location ~* \.php(/|$) {
          fastcgi_split_path_info ^(.+\.php)(/.*)$;
          fastcgi_pass  unix:${config.services.phpfpm.pools.pool.socket};

          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO       $fastcgi_path_info;

          include ${config.services.nginx.package}/conf/fastcgi_params;
          include ${pkgs.nginx}/conf/fastcgi.conf;
        }
      '';
    };

When I try to access a simple php script in browser I only get File not found..

Mar 14 01:01:59 nixos-nginx nginx[99994]: 2023/03/14 01:01:59 [error] 99994#99994: *5 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 2001:9e8:30da:fc00:764b:6989:7b11:527d, server: domain.it, request: "GET /update.php HTTP/2.0", upstream: "fastcgi://unix:/run/phpfpm/pool.sock:", host: "domain.it"

I would recommend to copy an existing config like the nextcloud one.

Hosted by Flying Circus.