Nextcloud - Homeserve - Connect with Domain name and secure it

Some or all of the below information will be requested if it isn't supplied; for fastest response please provide as much as you can :heart:


Nextcloud version _(eg, 20.0.5)_: Latest
Operating system and version: Ubuntu 20.04)
Apache or nginx version _(eg, Apache 2.4.25)_:  `replace me`
PHP version _(eg, 7.4)_: *8.0.24*

The issue you are facing:

I want to connect my home server e.g. my nextcloud to a domain name. So I will be able to access it from outside my network

I tried most videos on youtube but I am stuck. I opened my port 443 and 80. I tried getting a free Dynamic dns, via dynu. I added it via 

*/15 * * * * wget -O dynulog -4 “

This seemed to have worked. I also added trusted domains via: sudo nextcloud.occ config:system:set trusted_domains 1 --value=DOMAIN

That worked too, but I noticed I had to add the trusted domain and internal ip again a few days later.

I am new to this, so please apoligise. I need to access my Nextcloud from outside my network and secure it too. Any support would be appriciatd.

Thank you