How to Create Subdomain For My Blog on Digital Ocean

May 3, 2018 448 views
Initial Server Setup Ubuntu

Hello Guys So here is my question is i used godaddy hosting in past and there are direct option to create subdomain via cpanel but in digital ocean how can i create subdomain for my website (Paraphrasing Tool) and i also i think i have some speed issue also please help me guys. :(

1 Answer

When you create a new subdomain in cPanel it performs a few steps. Without the control panel automating these there is a little more work to do. To create a new subdomain for your droplet and ensure that it is routed correctly by your web server (serving the content in the correct folder) you can follow the following steps:

  1. Create a new "A" or "CNAME" record for your subdomain in the DNS section of the control panel (Networking->DNS) or if you are hosting your DNS elsewhere you can create the new record there. [This guide] covers how to use the DO DNS services and the steps needed to create an "A" or "CNAME" record on your domain.

  2. Create a new virtualhost/server block on your web server. Now we need to tell our web server what to do if it receives a request for sub.example.org since it was only serving example.org previously. We do this by creating a new Virtualhost (Apache) or Server Block (Nginx) that will tell the web server what to do with a request depending on what name is being requested.

This guide covers setting up virtualhosts in Apache.
This guide covers setting up server blocks in 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.
Have another answer? Share your knowledge.