Setup a Namecheap Domain with ZEIT Now

Use your Namecheap registered domain as an alias for your ZEIT Now deployments.

In this guide, we will cover how to use your Namecheap registered domain as an alias for your ZEIT Now deployments.

Step 1: Adding and Verifying Your Domain

First, you need to add your Namecheap registered domain to your ZEIT account. To get started, use the Now CLI:

now domains add <domain>

The command above adds the domain to your ZEIT account. Once it has been added, the Now CLI outputs some information needed to verify ownership of the domain.

There are two options available for domain verification:

  • Verify with Nameservers.
  • Verify with TXT record.

The Verify with TXT record ensures a smooth zero-downtime migration.

Adding a domain with Now CLI.

Nameservers Verification

If you want to opt for verifying your domains with Nameservers, you must use the nameservers listed when you added a domain via the Now CLI. The upside to verifying with Nameservers is that you are verifying and pointing to Now at once.

Use the following command to list the set of nameservers needed for verification:

now domains inspect <domain>

Inspect a domain with Now CLI.

Now, head over to namecheap.com, log in and click on Domain List.

Namecheap Domains List Page.

Next, click on the Manage button on the domain you want to migrate to Now as indicated by the arrow in the image above.

In the page you are directed to, scroll down to the NAMESERVERS section, click on the dropdown form and select CustomDNS as shown in the illustration below:

Dropdown for selecting the Custom DNS option.

Add the intended nameservers gotten from running the inspect command to the Custom DNS form in the order they are given and save the configuration.

Once Namecheap is done propagating the newly changed DNS for your domain, then your domain is ready to be verified. ZEIT automatically checks the domain for verification. However, if you are keen on manually verifying it, then run the following command:

now domains verify <domain>

TXT Record Verification

This option is great if you intend to verify your domain, but not point to Now yet!

In your Namecheap Domain List dashboard, on the domain you want to migrate, click on the Advanced DNS tab. Now, scroll down to the Host Records section, and click on the Add New Record button.

Select TXT Record as the record type, add _now as the host, and the value you were given for the record when adding your domain. You can fetch the value again using the now domains inspect <domain> via the Now CLI.

Adding a TXT record with Namecheap's domain Advanced DNS settings.

Your domain will be verified after adding the TXT record. Once ZEIT verifies your domain, you'll automatically receive an email. You can also manually use the command below to force a domain verification:

now domains verify <domain>

Step 2: Configuring your Domain on Now

Once your domain has been verified on Now, you can configure your domain with DNS records and alias a deployment to it.

Adding DNS Records

Now provides an easy to use command that allows you to add DNS records from the CLI. In this example, you can configure your domain with a set of Gmail MX records via the now dns add command:

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

Learn more about using the now dns command.

Deploying and Aliasing

ZEIT Now is dedicated to making deployment easy. If you have not yet deployed an app, take a look at the Deployment Basics documentation or at some other guides or examples to get started. The aliasing process will also generate a free SSL certificate for your domain.

When you are ready to deploy and alias, using the alias property containing your domain, within your now.json.

{
  "alias": "www.yourdomain.com"
}

Adding an alias to your project's now.json file.

You can deploy and set up an alias to your domain with one command:

now --prod

Deploying a project to a production alias.

We highly recommend using either the Now for GitHub or Now for GitLab apps coupled with the same alias configuration option which will allow your app to be deployed on push to your GitHub repository and aliased automatically when merged to the default branch.

Step 3: Pointing to Now

If you already verified your domain with nameservers, then this step is done.

The final step of migrating your domain to Now is to point your domain to ZEIT DNS with the intended nameservers set. Using now domains inspect <domain>, you can always find the intended nameservers to use with your domain.

Once Namecheap's propagation of the updated nameservers is complete, your domain will automatically point to the app you deployed before.



Written By
Written by unicodeveloperunicodeveloper
on February 15th 2019