Attach an external or sub domain to your zeit deployments


Last time I talked about how to deploy your website on a CDN based platform at info here:

However when everything was done, I ended up with a deployment address looks like this:

Then I replaced all of my asset with this prefix and my assets were returned as expected. I wanted to change this to a subdomain of my main website, this is what I have done yesterday.

First you'll have to create a CNAME record into your DNS zone of your domain:

This means will point out to

Once this was done I only added an entry zone into my nginx configuration file in order to declare this new entry, bind it to the certs.

NB: I am using let'sencrypt for SSL management, basically certificates are initialy design for the main domain. Recently let'sencrypt added wilcard support meaning they will handle SSL for your main domain and subdomain *

So I just changed my certificates to a wildcard one:

/usr/bin/certbot certonly --manual  --email YOUR_EMAIL_ADDRESS --server --agree-tos -d *.YOUR_DOMAIN

You'll be asked to confirm challenge while adding a TXT RECORD for:

TXT acme-challenge.YOUR_DOMAIN with value from cli

Once the certs are ok, update your nginx accordingly.

Once this is done make sure you have now-cli installed, if not:

npm install -g now

Then to alias your subdomain the command is:

now alias you.subdomain

Creating an alias

You'll have to make a TXT RECORD to confirm you own the domain.

Zeit will generate SSL for you an alias your domain to their url, then you'll be able to get your asset hosted on but from your subdomain.

More info here: