How To Set Up a Host Name with DigitalOcean
DigitalOcean’s DNS allows you to easily set up your hostname from the DigitalOcean control panel.
Before you get started, you do need to have the following:
- A Droplet (virtual private server) from DigitalOcean. If you don’t have one, you can register and set one up in under a minute
- A Registered Domain Name. As of yet, you cannot register a domain through DigitalOcean.
Step One—Look Up Information with WHOIS
The first thing you need to do to set up your host name is to change your domain name server to point to the DigitalOcean name servers. You can do this through your domain registrar’s website. If you do not remember where you registered your name, you can look it up using “WHOIS”, a protocol that displays a site's identifying information, such as the IP address and registration details.
Open up the command line and type:
WHOIS will display all of the details associated with the site, includng the Technical Contact which includes your domain registrar.
Step Two—Change Your Domain Server
Access the control panel of your domain registrar and find the fields called “Domain Name Server.” The forms for my domain registrar looked like this
Point your name servers to DigitalOcean and fill in three Domain Name Server fields. Once done, save your changes and exit.
The DigitalOcean domain servers are
You can verify that the new name servers are registered by running WHOIS again; the output should include the updated information:
Domain Name: EXAMPLE.COM Registrar: ENOM, INC. Whois Server: whois.enom.com Referral URL: http://www.enom.com Name Server: NS1.DIGITALOCEAN.COM Name Server: NS2.DIGITALOCEAN.COM Name Server: NS3.DIGITALOCEAN.COM Status: ok
Although the name servers are visible through WHOIS, it may take an hour or two for the changes to be reflected on your site.
Step Three—Configure your Domain
Now we need move into the DigitalOcean control panel.
Within the Networking section, in the Add a domain section, fill in your domain name. Click on the Add Domain button to add the domain. Note: The domain name should not have a "www" at the beginning.
You will reach a page where you can enter all of your site details. To make a new hostname, you only need to fill in the A record. If you are using an IPv6 address, you should enter it into the AAAA record.
A Records: Use this space to enter in an IP address of the server that you want to host your domain name on and the host name itself. The hostname will be prepended to your domain name. For example:
To accomplish this, create a new A record with the HOSTNAME set to the word "test". In the WILL DIRECT TO field, enter the IP address of the server you want associated with that name. Your screen should look like this:
Click the Create Record button to add the record.
You can also connect an IP to a domain name with nothing before it:
To accomplish this, create a new hostname with the symbol "@" in the HOSTNAME field. Your screen should look like this:
Again, click the Create Record button to add the record.
AAAA Records: Use this space to enter in the IPv6 address of the server that you want to host your domain name on and the hostname itself, a name prepended to your domain name. You can also connect your IP to the base domain name with nothing before it. To accomplish this, create a new hostname with the symbol "@' in the hostname field. Your screen should look like this for example:
When you are ready, click the Create Record button.
CNAME Records: The CNAME record works as an alias of the A Record, pointing a subdomain to an A record— if an A Record’s IP address changes, the CNAME will follow to the new address. To prepend www to your URL, click on the CNAME record type and fill out the two fields.
Your screen should look like this:
You can also set up a catchall or wildcard CNAME record that will direct any subdomain to the designated A record (for example, if a visitor accidentally types in wwww instead of www). This can be accomplish with an asterisk in the CNAME HOSTNAME field.
Your screen should look like this:
If you need to set up a mail server on your domain, you can do so in the MX Records.
MX Records: The MX Records fields include HOSTNAME, which determines which hosts the mail record should apply to, the MAIL PROVIDERS MAIL SERVER field, which points to the actual mail server, and the PRIORITY field, which designates the order in which the mail servers should contacted.
In most cases, the HOSTNAME field should be "@" to apply to the base domain. Records always end with a "."A generic MX record looks something like this: mail1.example.com.
Below is an example of MX records set up for a domain that uses google mail servers (note the period at the end of each record). These can be added automatically by clicking on the Add Gmail MX Records button:
Once you have filled in all of the required fields, your information will take a while to propagate, and the Name Server information will be automatically filled in. Your domain name name should be up and supported in a few hours.
You can confirm, after some time has passed, that the new host name has been registered by pinging it:
You should see something like:
# ping test.example.com PING test.example.com (22.214.171.1249) 56(84) bytes of data. 64 bytes from 126.96.36.1999: icmp_req=1 ttl=63 time=1.47 ms 64 bytes from 188.8.131.529: icmp_req=2 ttl=63 time=0.674 ms
You should also be able to access the site in the browser.
If you have any issues or questions, feel free to reach to us on the Forum or by submitting a Support Ticket. Additionally, you can visit our DNS Tips and Tricks page for more information on the DNS capabilities.