Sail Knowledgebase

How to Add or Remove Domains in Your Sail CLI Project

In this article you will learn how to manage domains associated with your WordPress site using Sail CLI.

If you like Sail, don't forget to give us a star on GitHub!

Internal domain

When you create a new Sail project, it will be assigned a random internal domain, usually <random-hash>.justsailed.io. You can use this internal domain to try out Sail, play around with various themes or plugins, or create a staging site for testing. However, it is recommended that you use your own domain for production sites.

DigitalOcean DNS

Sail uses the DigitalOcean DNS infrastructure to work with domains. Before adding a domain to your Sail project, you should first point its nameserver records to DigitalOcean:

  • ns1.digitalocean.com
  • ns2.digitalocean.com
  • ns3.digitalocean.com

DigitalOcean has a handy guide on how do that for common domain registrars.

Note: When moving DNS from another provider to DigitalOcean, don't forget to copy all existing records from that provider, including MX, TXT and CNAME records. If you fail to do this, you may break some third-party services, such as e-mail, transactional mail, Google search console verification, and others.

Add a domain

To add a new domain to your Sail project, run:

sail domain add example.org

This will create a Sail API record, a DNS zone and record on your DigitalOcean account, pointing to your application droplet. If you would like to add the API record only (if your DNS is hosted elsewhere, for example), add the --skip-dns flag.

You can add multiple domains and subdomains by separating them with a space.

Remove a domain

To remove a domain from your Sail project, run:

sail domain delete example.org

This will remove the API record for the domain, as well as the DNS zone from DigitalOcean. If you'd like to skip touching the DNS zone, use the --skip-dns flag.

List domains

To get a list of all domains associated with your Sail project, use:

sail domain list

The list will also show internal domains, https status the primary domain.