Help setting up nextcloud correctly


I have my nextcloud server running to save some photos on it.
So far its a simple setup with docker-compose.
I have all my containers running behing Traefik2 reverse proxy and the Nextcloud image with apache2 and I have the following code for that container:

    container_name: Nextcloud
    image: nextcloud
    restart: unless-stopped
    network_mode: bridge
      - PUID=99
      - PGID=100
      - 9001:80
      - "${SETTINGS}/Nextcloud/config:/var/www/html/config"
      - "${SETTINGS}/Nextcloud/www:/var/www/html/"
      - "/mnt/user/Nextcloud:/var/www/html/data"
      - "traefik.enable=true"
      - "traefik.http.routers.nextcloud-http.entrypoints=http"
      - "traefik.http.routers.nextcloud-http.rule=Host(`cloud.${DOMAIN}`)"
      - "traefik.http.routers.nextcloud-http.middlewares=https-redirect@file"

      - "traefik.http.routers.nextcloud-https.entrypoints=https"
      - "traefik.http.routers.nextcloud-https.tls=true"

      - "traefik.http.routers.nextcloud-https.rule=Host(`cloud.${DOMAIN}`)"
      - "traefik.http.routers.nextcloud-https=nextcloud"
      - "traefik.http.routers.nextcloud-https.service=nextcloud"

      - ""

It is working and I can save things on it, but I ended up having some problems while using the online client.

For example, when I uploaded multiple files at once (for example 200), since there were multiple concurrent requests, some would fail.

But the worst is when I enter in a folder and it tries to generate all the thumbnails. When that happens, depending on the folder, the apache2 service ramps up to 100% CPU and 100% memory and all containers fail, getting with all my resources at 100%.

The server has unraid with a Ryzen 3700x (8 cores) and 32GB RAM, so I don’t think this is normal.

Can anyone lead me on what I’m doing wrong on the setup?

Thank you in advance!

Do do have configured all tuning option?

I also get sometimes problems. Today i deleted 100 files in a folder and three files were not deleted. So i had to delete them again.