# Deploy an Astro site on your own domain

Source: https://naijacloud.com/guides/astro-custom-domain

This guide deploys a static Astro site to Naijacloud from your terminal and puts it on your own domain. At the end you’ll have every page Astro builds served over HTTPS, first at your naijacloud.app address and then at your domain, with a one-command redeploy for every change. The stack is Astro 7, deployed with the naijacloud CLI. Static sites are free and don’t count against the free tier’s one app.

_10 min · Beginner · Last verified 2026-10-07 · Stack: astro_

**What you'll have at the end:** Your Astro pages, each built to its own HTML file, served at your naijacloud.app address and then at your own domain with a certificate issued for you.

## Before you start

- Node.js 20 or newer.
- A Naijacloud account and a project to put the site in. This guide uses a project called `shop` and its `dev` environment.
- A domain you can add DNS records to, for the last step.

## Create the site

Skip this if you have an Astro site already. Otherwise:

```sh
$ npm create astro@latest my-astro-site -- --template minimal
$ cd my-astro-site
```

Astro builds static HTML into `dist` by default, one file per page, which is exactly what a static site serves. If you’ve added an SSR adapter, this guide isn’t the one: deploy it as a web service instead.

## Install the CLI and deploy

```sh
$ npm install -g @naijacloud/cli
$ naijacloud login
$ naijacloud deploy --name my-astro-site --output dist --no-spa --env shop/dev
```

`deploy` runs `npm run build` on your machine, uploads `dist` and waits for it to go live:

```sh title="naijacloud deploy" nocopy
[build] 2 page(s) built in 144ms
[build] Complete!
Created site my-astro-site in the target environment
  BUILDING
  DEPLOYING
  RUNNING
https://my-astro-site.naijacloud.app
Wrote naijacloud.json
```

`--no-spa` matters for Astro: every page has its own file, so a path that doesn’t exist should be a 404, not your home page. Commit `naijacloud.json`; after that, `naijacloud deploy` on its own redeploys this site.

## Add the domain

In the dashboard, open the site and go to **Domains**. Type your domain into **Custom domain** and click **Add domain**. The table under it lists the records to create, with a **Type**, **Name** and **Value** for each and a copy button on every value.

Add each record at your DNS provider exactly as shown. A root domain such as `example.com` gets an **A** record. When you add a root domain, the dashboard also offers **Add www**, which redirects `www.example.com` to it; add the record it shows for `www` too.

> **Warning: Turn the provider’s proxy off for this record**
>
> If your DNS provider can proxy traffic (Cloudflare’s orange cloud, for example), switch it off for these records. With the proxy on, the domain can’t be verified and HTTPS can’t be set up.

## Wait for HTTPS

The domain shows **Waiting for DNS…** and checks again on its own; **Check now** checks immediately. Once the record resolves to Naijacloud, the certificate is issued and the status changes to **Verified · HTTPS ready**. New records can take a few minutes, and sometimes longer, to reach every resolver.

Open `https://example.com`. Your site is there, and it stays at its naijacloud.app address too.

## Reference

- [Static sites](https://naijacloud.com/docs/deploy/static-sites.md)
- [Deploy from the CLI](https://naijacloud.com/docs/cli/deploy.md)
- [Custom domains](https://naijacloud.com/docs/domains/custom-domains.md)
- [DNS](https://naijacloud.com/docs/domains/dns.md)

All guides: https://naijacloud.com/guides · Index for agents: https://naijacloud.com/llms.txt
