When you deploy an app with ZEIT Now, you will have a unique deployment URL like this: https://my-web-app-avvuiuuwto.now.sh.
If you deploy your app multiple times, you will have multiple URLs. With these different deployment URLs, you can easily point users to a specific version of your app.
However, you cannot ask your users to visit those addresses. This is because the addresses are not easy to remember and they change every time you deploy a new version.
Hence, you need a fixed domain name.
In this guide, we are going to map a domain name into one of those deployment URLs of your app by using the
now alias command.
The four different ways to use the
now alias command are:
- Using a now.sh domain
- Using a custom domain, managed by now
- Using a custom domain, DNS managed by now
- Using a custom domain with a CNAME
Let us explore each method in detail.
This method is the easiest way to use a domain name. To obtain a domain name with the
now.sh postfix instantly, simply run the following command:
Your users may now access the above deployment URL using https://my-web-app.now.sh
If you want to use a custom domain for your app, the easiest method is to buy a domain name for your app using ZEIT Now.
Simply run the following now alias command:
Here, we are attempting to assign the
my-web-app.com domain name to the above deployment URL. If the domain name is available, you may confirm and buy it without leaving the terminal.
After the confirmation, ZEIT Now will handle all the technical details for you and allow your users to access your app using https://my-web-app.com.
In this process, ZEIT Now will set up a Let's Encrypt SSL certificate for your domain automatically.
If you already have a domain name, this is the best option for you. With this method, ZEIT Now will handle all the DNS management for your domain.
First of all, you need to point your domain's nameservers to our global DNS service. Here is how to do that:
- Visit your domain name provider and find a place where you can add custom nameservers.
- Select two or more nameservers from this list.
- Set them as custom nameservers for your domain.
For example, assume that your domain name is
After you have set up the nameservers, simply run the following
now alias command:
Then, you can access your app using https://my-custom-domain.com.
You can also use a subdomain of
my-custom-domain.com like this:
Even in this process, ZEIT Now will set up a Let's Encrypt SSL certificate for your domain automatically.
If you are managing a DNS setup for your domain, you can use this option.
For example, assume you have a domain name called
my-app.work and you already have a DNS setup for that.
To map the
ui.my-app.work domain for one of the deployment URLs of your app, visit your DNS provider and add a CNAME record for
ui.my-app.work pointing to
After that, run the following command:
You will then have an error like this:ZEIT Now wants to verify the ownership of your domain. That's why it throws an error.
- Next, add the TXT record as mentioned above error message.
- Run the
now aliascommand again:
Now you may access your app using https://ui.my-app.work
In this case, ZEIT Now will setup a Let's Encrypt SSL certificate for your domain. However, before you do that, you need to verify the domain.
You can also use a naked domain like
my-app.work with this method. In that case, you need to use an ALIAS record instead of a CNAME record.
Some DNS providers do not have ALIAS records. In that case, the functionality of ALIAS records is managed using CNAME records.