Register a domain name

To host a web service, one of the first things you will need to do is to register your domain name (e.g., example.com). This will be the root domain name used for all of your service links and it is part of what your users will need to type into their web browsers (or click on) to visit your pages.

Domain name registration

The public domain name registration system is controlled as a scarce resource that you must pay for the use of.

If domain names were given out for free, all of the good ones would be taken by now, but due to the imposed registration costs, there are still some good names left to be had. In return for your fee, you receive exclusive control of the domain name for the period that you paid for.

You can never truly own a domain name outright, because you need to keep paying the registrar to keep the record active, so it is best to consider a domain name as a rental service. You may pre-pay for several years in advance or just pay for one year at a time. If you stop paying and the record expires, the name will no longer resolve to your services and you may permanently lose control of the name.

Register an Internet domain name

You can register a domain name from any registrar. For documentation purposes, we will use Gandi.net, but these instructions will be similar regardless of the registrar you pick.

Set up Gandi.net
  • Sign up for an account at Gandi.net
  • Once signed in, from your dashboard, click Register.
  • Search for any domain name you like, e.g., your-name.com.
  • Add your domain to the shopping cart, go to checkout, and complete your purchase.
  • Once you have purchased the domain, it should show up in your Dashboard, under the Domain tab.
  • Leave this browser tab open, you will return to it in the next chapter.

Transfer DNS to DigitalOcean

Choose any supported DNS provider

All examples in this book use DigitalOcean as the DNS provider. You may choose any DNS service that provides a programmatic API supported by go-acme LEGO.

Sign up for a DigitalOcean account (using this referral link helps support this site).

Set up Gandi.net
  • Login to your Gandi.net dashboard.
  • Click the Domain tab.
  • Find your domain name in the list and click on it.
  • Click on the Nameservers tab.
  • Click on the edit button to create new External nameservers.
  • Delete all existing nameservers that may exist.
  • Add the following nameservers, specific to DigitalOcean:
    • ns1.digitalocean.com
    • ns2.digitalocean.com
    • ns3.digitalocean.com

Wait a few minutes for the change to take effect, then you can verify the setting from your workstation using the whois command:

[bash]: Run this on your workstation:
whois example.com
(stdout)
Domain Name: example.com
Registrar WHOIS Server: whois.gandi.net
Name Server: ns1.digitalocean.com
Name Server: ns2.digitalocean.com
Name Server: ns3.digitalocean.com

The output shows a report for your domain registration including the list of the new nameservers.

If you don’t have whois installed, you can use the web version provided by google.