For reasons related to CPU performance, RAM, software availability (PHP, MariaDB, various file-preview tools), ZFS, and security, NextCloud runs in a FreeBSD jail on either an APU3C4 or an ODROID H2. It is behind a reverse proxy on a restricted subnet as well (outside world --> firewall --> router --> reverse proxy --> NextCloud). Your favorite regularly updated, Linux-based server/desktop distro would be a good choice as well (Debian, for example). I wouldn't run either directly on the router itself.
DDNS if your assigned IP changes quickly, with Let's Encrypt certificates.