Mar
14
2015

Subdomain on Digital Ocean Cloud in Simple Steps

Here are the steps to add a subdomain and get it working from a sub-folder in less than 20 minutes.

Step 1: Create an ‘A’ record for the subdomain.

To enable the subdomain we need to first add a subdomain host. Go to your DNS settings page and open the records where you have main domain DNS settings. Now add an ‘A’ record with subdomain in ‘Enter Name’ field (only add subdomain part. For example if you are going to create a subdomain blog.example.com then only enter blog and in the IP address field, enter the droplet IP.

 

 

DigitalOcean Control Panel

 

Step 2: Create a virtual host file for the subdomain.

– Now navigate to your /etc/apache2/sites-available folder.
– Create a file named subdomain.domain.com.conf. You need to replace the subdomain and domain with yours.

– Paste the following code in the file. You can use nano command to create the file.

It will create a document and open it for editing. Replace the subdomain and domain in the code as needed.

 

Step 3: Enable the subdomain.

We need to enable the subdomain before it can start showing up. Without this step the subdomain will show the main website.

We’ll also need to reload apache with new subdomain configuration.

 

Related Posts

About the Author: