How to Add a Subdomain to Your Domain

Adding a domain you own to your DigitalOcean account lets you manage the domain’s DNS records with the control panel and API. Domains you manage on DigitalOcean integrate with DigitalOcean Load Balancers and Spaces to streamline automatic SSL certificate management.

A subdomain is an additional hostname of a domain. Subdomains can point traffic to a specific IP address or other parts of a website. For example, a company could use the domain to direct traffic to their website’s home page and use the hostname to send traffic specifically to their support portal that resides on another service or server.

If you are setting up a new hostname that points to a different web directory on the same Droplet as your current domain name, follow this document’s instructions to set up your DNS record and then review these community tutorials for configuring your web server:

Create a New Hostname with an A Record

To add the hostname from the control panel, click Networking in the main menu. In the Domains tab, click the domain name you want to add the new hostname to.

In the Create new record screen, select the type of record you want to add to the hostname by selecting its tab.

Enter the new hostname into the HOSTNAME field. The characters entered into the Hostname field append to your domain name and a preview of the hostname’s full address appears below the Hostname field. If your hostname contains non-ASCII characters (such as accents or other Unicode characters), you must convert it to Punycode before adding it.

Enter the applicable data into the WILL DIRECT TO field. Depending on the type of record, this can be an IP address, a Droplet, a mail server address, or other DNS record data. Set the TTL (time to live) value to your preferred value in seconds. We recommend a value between 3600 (1 hour) and 86400 (24 hours) for most records because this allows for caching while still refreshing records regularly.

A screenshot of the DigitalOcean control panel showing an A recorded being added to the new sub domain

Click Create Record. This creates the record at the new hostname.

A screenshot of the DigitalOcean control panel showing a new A record added.

You can verify the record was added by looking up the new hostname with DigitalOcean’s DNS Lookup tool. Enter your new hostname into the search field, then click Search. The DNS Lookup tool returns the DNS records that reside at the new hostname.

It may take up to 48 hours for the new hostname to propagate across the internet.

You can also use BIND’s dig tool to look up the records for the new hostname from the command line:

dig <your new hostname>`

dig returns DNS record information about your hostname. The newly created record is displayed in the ANSWER SECTION.