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

Posted March 26, 2018 2.9k views

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.

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.

Submit an Answer
1 answer


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 and your Droplet’s IP address as the value.

For step 2, check out these tutorials:

  1. If you’re using Apache:
  2. If you’re using Nginx:
by Brennen Bearnes
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 16.04 server.