@neurokrish Ports are assigned differently in Docker installs that Cloudron uses. It might help to know what you're trying to access and where you're trying to access it from (i.e. outside of the home network?).
If you're trying to setup access to a home server for access outside of the network, you usually would simply have your router configured with a VPN and DDNS in most cases. You may find something like this useful as well: https://lifehacker.com/geek-to-live-how-to-access-a-home-server-behind-a-rout-127276
You can also use port-forwarding but it's generally just done to the server itself (so the outside ports) rather than individual ports at the app level because those can change and I think are a bit on the dynamic side in Docker depending on the YAML file and other configs.
For incoming ports to Cloudron, you can check out this section in the documentation: https://docs.cloudron.io/security/#inbound-ports
To clarify... you would normally only have your router forward to the server itself on the exposed public ports, since the ports on the actual apps running inside Docker (which is what Cloudron uses for app deployments) are internal ports and not exposed externally.
@neurokrish to make it possible to still reach your Cloudron externally, don't rewrite the DNS records as such, however some routers allow for overwriting individual records if you use the DNS server provided via DHCP from your router.
Another more local workaround can be to configure your hosts file on your laptop/PC itself. I don't know how Windows or MacOS handle this but on linux there is a
/etc/hostsfile where you can hardcode DNS records.
If it's an isolated need, one time thing, use the hosts file records.
If it's going to be a bigger things with my hosts and apps, then you might as well run an internal DNS server with a private zone, so you have your private domain resolving anything you need for internal needs. (rama.home for ex.)
Some routers can do this, or you can download an appliance that does it.. zeroshell or similar.
Thank you @d19dotca @nebulon @robi for your replies. I use adguard on the same server which allows for DNS rewrites. I guess I was trying to achieve what Resilio sync does (e.g. connect to peers using LAN when in LAN).
In this case, I wanted to try by pointing the DNS name of nextcloud installation to local server IP:port. I am not sure if this will be possible (probably not right? unless I change the server itself in my nextcloud client?). If it's not possible, it is OK I guess.