Recently I installed Nextcloud Hub 25 Autumn (32.0.3) on the last version of Ubuntu with the latest versions of Apache, MySQL, PHP, etc.
PHP Version: 8.3.6
MYSQL Version: 10.11.13
The Hardware is Lenovo M600, Celeron N3000/4 GB / 120 SSD and data folder is stored on external SSD 1T connected to USB 3.
The system runs well, but when I browse in 300 G of photos not working very well, I have to wait a long time before I can view the photos in a folder, and in Nextcloud Administrator Settings > System, the CPU Loading is more than 200%
First of all not using external SSD connected to USB as data folder but instead an internal NVMe (Non-Volatile Memory Express). NVMe is the much more modern, significantly faster standard than SATA.
Hosting 300GB of photographs on a low-end system might never be very satisfying. but you can look at preview generator app which will generate previews in advance and allow smoother browsing experience (otherwise you simply wait until preview are generated on first visit).
Nextcloud is a generic application If your primary goal is to host pictures there are more optimized solutions like immich or photoprism.