When migrating to another set of nameservers, there can often be downtime incurred. In this guide we will walk you through adding your domain to ZEIT and setting it up before migrating the nameservers, ensuring no downtime at any point.
To get the process started, you will need to add your domain to your account or team by using the following command:
now domains add <domain>
Adding a domain to a ZEIT account using Now CLI.
This command will add the domain to your account and output information you will need in order to verify the domain is yours.
You will receive two options:
- Verify with Nameservers
- Verify with TXT record
Adding a domain with Now CLI.
To avoid pointing the nameservers to Now prematurely, use the TXT method for verification.
With your domain provider, create the TXT record using the
name (also known as
_now and the value provided when adding the domain.
now domains inspect domainto retrieve the verification methods and value again.
Now periodically checks for whether or not the TXT record (or nameservers in another case) has been added and then mark the domain as verified when it detects them. You can force Now to check for the verification by using the following command:
now domains verify <domain>
Verifying a domain with Now CLI.
Now that your domain is verified, you have more control over it with Now. You can now generate an SSL Certificate, add any DNS Records, and deploy your app using your domain, all ready for when you switch over fully.
With Now CLI, you can generate an SSL certificate for your domain and all subdomains, called common names (CNs), with the following command:
now certs issue \*.<domain> <domain> --challenge-only
Generating an SSL certificate for a domain and all subdomains with Now CLI.
You will then be asked to solve a DNS challenge, required for the Certificate Authority (CA) to prove that Now has sufficient permissions, consisting of two TXT records.
Once these TXT records are added to your domain via your domain provider, run the
now certs issue *.<domain> <domain> command again to attempt the certificate issuance.
The next step is to add any DNS records your domain might have had before. For example, MX records.
In this example, we'll take Gmail's current MX records and add them with Now CLI:
now dns add <domain> @ MX ASPMX.L.GOOGLE.COM 1 && now dns add <domain> @ MX ALT1.ASPMX.L.GOOGLE.COM 5 && now dns add <domain> @ MX ALT2.ASPMX.L.GOOGLE.COM 5 && now dns add <domain> @ MX ALT3.ASPMX.L.GOOGLE.COM 10 && now dns add <domain> @ MX ALT4.ASPMX.L.GOOGLE.COM 10
Adding MX records to a domain with Now CLI.
The above demonstrates using the
now dns add command to add multiple MX record to your domain.
To use your custom domain with your project, you can add it to your project from the Domains section of the project dashboard.
To do this, select your project from the dashboard and click the Domains tab. Here you will find an input to add your custom domains for production, such as
If the domain is registered to your account and available for use it will be indicated below the input box and you can continue. Otherwise, if the domain is not registered to your account, it will automatically be added and we will attempt to verify it for you.
When the domain is verified and you're ready to deploy your project to production, you can use the production target with Now CLI in your terminal:
Deploying a project to production with Now CLI.
Now, your domain will be pointing to your latest deployment and you're are ready to move your nameservers across to show that deployment.
Once your domain is set up correctly and contains all you need for a successful migration, you will be free to change the nameservers of your domain to point to ZEIT DNS via your domain provider.
now domains inspect <domain>, you can find your intended set of nameservers to use with your domain, in case you have forgotten them when you first added the domain.
Once the nameservers have been added and propagation is complete, your domain will successfully point to your deployment from your domain, which includes a free SSL certificate and any DNS records you setup!