How to create a subdomain?

If you’ve already bought a domain, and don’t want to purchase another for your sub-site, then you can create a sub-domain for your website. It can be a whole different website for which you can give the hyperlink on your main website.

Generally, the domain providers have an option to configure the sub-domain under the domain settings in the cPanel and we need to create A record there.

If you have a VPS or dedicated Server with a Public IP, the configure the IP value of the A record with the Public IP of the Server. So you need to provide following values:

Type: A record

Host: e.g. if your domain is mywebsite.com then put host as blog. So your subsite domain will be blog.mywebsite.com.

Value: Put the Public IP of the VPS or dedicated Server.

TTL: The TTL serves to tell the recursive server or local resolver how long it should keep said record in its cache. Usually, the recommended default is 1 hour but you can change as per your requirement.

Various domain providers like godaddy.com, cloudflare etc. have this kind of interface to point your subdomain to an IP address.