Question

When im On Shared Hosting im Simply Create a SubDomain From Cpanel But in Digital Ocean How Can We Create Sub Domains?

How Can We Create A Subdomain on Digital Ocean Server Because Im Using Shared Hosting Before So Im Creating Subdomains From Directly CPANEL But Now I Migrated My Site (Charter Speed Test) To The Digital Ocean How Can We Create A SubDomain For The Website Please Guide Me Or Give Me Any Tutorial For This.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi,

It looks like you are using Cloudflare for your website. There are two parts to making a subdomain work:

  1. Configuring the subdomain to point to your Droplet by adding a DNS record
  2. Configuring your web server to accept connections from the subdomain and serve the right content

Since you’re using Cloudflare, Step 1 needs to be done through their control panel. Log in to your account, go to the DNS page, and add an A record with the name as just the subdomain without the domain itself (e.g. sub for sub.mycharterspeedtest.com) and your Droplet’s IP address as the value.

For step 2, check out these tutorials:

  1. If you’re using Apache: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
  2. If you’re using Nginx: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04