Deploy an Astro site on your own 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.
astroYour 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
shopand itsdevenvironment. - 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:
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
deploy runs npm run build on your machine, uploads dist and waits for it to go live:
--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.
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.