If you have already a working site, hosted on a specific domain and you want to add a sub domain that points to a site hosted on a different VPS, then you need to add your public IP to point to that site.
For example I have a domain registered on Bluehost and I want to create a sub-domain that points to my site hosted on Digitalocean. To do so follow this steps.
First of all you must have credentials to login to the cPanel of your site.
Login to your cPanel and search for advance DNS zone editor option
Click on this option and you will find list of available domain with their IPs and sub-domains if any.
- Create a record, Add your subdomain name here, then your TTL value. Then your site type which you want to point.
- select A if your are pointing to an external public IP which must be static. and it must be IPv4 if it is IPV6 then select AAAA CNAME if you are pointing to a domain name or sub-domain.
- Now in Address field add the address or domain name.
- Then click Add Record button.
Done! Now wait for at least 24 to 72 hours. It will take this much time to get effect. This time is not sure.
If you want to edit or cancel a detail then you can select and update or cancel.