would be good if you can share the web server used
I recall a longer discussion with a user on GitHub about a similar setup. Maybe you can have a look.
Puhh, ja I remember one case where I instructed a user how to do it and one year later during another web application install he ran into a then expected error and it took quite a while to remember that special setup and fix things. Note that there is not really any reason why a subdomain would be better to split applications compared to sub directories. For security reasons (to marke scraping a little harder), sub directories are actually better and easier to handle regarding HTTPS certificates and webserver-side settings/hardenings in general. Sub domains make sense when you use different physical servers which run different applications for the same domain/organisation, otherwise they will make things more complicated.
There are multiple ways to achieve it, via proxy, via rewrites or by changing the webroot, and the Nextcloud config needs to be altered. It depends hence whether Nextcloud is and will always be the same web application/website on that system or if you plan to add other ones, now or in the future.