Same IP address with different port number

How to assign “A” record for same IP’s but with different port number?

I have two websites, and both are hosted in digital ocean server which means it takes the IP of the digital ocean server. In this case it is differentiated with the help of port number, but “A” record doesn’t accept port number. So, what is the right approach?

The short answer is that you can’t do this at the DNS level.

You could set up a reverse proxy on your server that listens on port 443 (and maybe 80) which forwards requests to your two services (neither of which would live on the standard/default ports).

This is a bit of an advanced configuration.