# Domains

URL: https://docs.vaultpanel.net/guides/websites/domains

> Add aliases and wildcard domains to a website, create subdomains as sites of their own, and check that each domain points at the right server.

Every website has a primary domain and up to 19 more. VaultPanel writes them all into the site's NGINX configuration, and checks in public DNS that each one reaches the site's server.

## Primary domain and aliases

The first domain of a website is its primary domain. It names the site in lists, and the agent's health check and the panel's uptime checks use it (or, when it is a wildcard, the first domain that is not). The other domains are aliases: NGINX serves the same site for each of them.

To change them, open the website, go to the **Domains** tab and click **Edit domains**:

- **Primary domain**: the main address.
- **More domains**: one per line, such as `www.example.com`.

A website can have up to 20 domains, each listed once. A domain can belong to one website only, so VaultPanel refuses a domain that another site, or the panel itself, already uses.

> **Note:**
Domains added after a certificate was issued are not in it yet. The **SSL** tab says so: issue the certificate again to include them.

## Wildcard domains

A domain such as `*.example.com` makes the website serve every name under `example.com` that no other website lists itself. NGINX prefers exact names, so `shop.example.com` on another site still goes to that site.

- The DNS needs a wildcard record: an `A` (or `AAAA`) record named `*` that points at the server.
- HTTPS for a wildcard needs a wildcard certificate (through a DNS check) or an uploaded certificate that covers it. Let's Encrypt's normal check cannot issue wildcard names. See [Wildcard certificates](https://docs.vaultpanel.net/guides/websites/ssl-certificates#wildcard-certificates).
- A wildcard over a suffix people register domains under, such as `*.co.uk`, is refused.
- Serving wildcard domains needs agent 0.37.0 or newer on the server.

## Check DNS

Before you issue a certificate, each domain needs an `A` or `AAAA` record that points at the website's server. **Check DNS** on the website's **Domains** tab (or on each row of **Web > Domains**) looks the domains up in public DNS and compares the answers with the server's addresses.

| Result | Meaning |
| --- | --- |
| **Points here** | The domain resolves to one of the server's addresses. |
| **Points elsewhere** | The domain resolves, but to other addresses. |
| **No DNS record** | Public DNS has no `A` or `AAAA` record for it. |
| **Lookup failed** | The lookup itself failed. |

For a wildcard domain, VaultPanel looks up a random name under it, so the check tells you whether the `*` record exists.

When some domains do not point at the server, the tab shows the addresses to use in an `A` record at your DNS provider. DNS changes can take a while to spread.

## The Domains page

**Web > Domains** lists the domains of all your websites in one place, with the website and server each belongs to, its DNS status and whether HTTPS covers it. Domains are added on each website's page; this page is for checking them.

## Subdomains

A subdomain such as `blog.example.com` can be served as a website of its own, with its own folder and Linux user, on the same server as its parent domain.

### Open the form

Go to **Web > Subdomains** and click **New subdomain**.

### Fill in the fields

| Field | Notes |
| --- | --- |
| **Subdomain** | The name before the domain, such as `blog` or `shop.eu`, and the domain to put it under: one of your websites' domains. `www` is not accepted: add `www.example.com` to the parent website's domains instead. |
| **Type** | **Static site** or **PHP site**. |
| **PHP version** | For PHP sites, one of the versions installed on the server. |
| **Document root** | The folder inside the site that is served. Defaults to `public`. |

VaultPanel names the new site after its domain (`blog.example.com` becomes `blog-example-com`) and picks a free name when that one is taken.

### Create it

The subdomain is created like any website. When one of the panel's [DNS zones](https://docs.vaultpanel.net/guides/dns-and-email/dns-zones) holds the parent domain, VaultPanel also adds an `A` record for the subdomain there (and an `AAAA` record when the parent domain has one), unless the name already has an address or alias. The record is taken out again when you delete the subdomain. When the DNS is elsewhere, add the `A` record yourself.

Subdomains also appear on **Web > Websites**, where they are managed like any other site. Deleting one from **Web > Subdomains** keeps its folder on the server unless you tick **Also delete its files**.

### Subdomains for hosting customers

Hosting customers can add subdomains under their own domains only. Each one counts against their plan's subdomain limit, not its website limit. When staff create a subdomain under a customer's domain, it belongs to that customer and counts against their plan.

## Name servers for customers

On a server that runs DNS, staff can set the name servers that hosting customers on it are told to use. Go to **Web > DNS Zones**, find the server under **DNS servers** and click **For customers**:

- **Name servers**: the host names customers set at their registrar, such as your hosting brand's name servers. Customers see them on their **My Hosting** page.
- **Add a DNS zone for each new customer domain**: when a customer creates a website for a new registered domain (`example.com`, not a subdomain), VaultPanel adds its DNS zone on this server with those name servers. The zone is removed with the customer's account.

See [DNS zones](https://docs.vaultpanel.net/guides/dns-and-email/dns-zones) for how zones work.
