as other pointed out the solution would be so called reverse proxy which is the first entity accepting all the requests from the internet and routing them to respective back-end system. may be you find the drawing in this post useful
until relevant for you just take two Nextcloud instances into account and ignore coturn, collabora and pihole