I wish I had the experience in Linux to code this myself.
I see many posts here and there with people wanting to change the ports that Nextcloud or NextcloudPi use. A config tool option to change ports would be really great.
I have found articles on changing apache which I intend to try. I run a website from home which already uses 80. And I am not sure how nextcloud uses 443 or if it even does.
There are good reasons to keep the default ports (accessible from all internet connections, some wifi spots block everything but port 80 and 443). You can set up another domain/subdomain and use virtualhosts on apache. If your normal website is only on port 80, you can just run Nextcloud via SSL (port 443). You must (nobody can force you but it is really recommended) run Nextcloud via SSL, if not all communication with your cloud (data, passwords, …) will be transferred without encryption!