To deploy Astro to your own server, first check whether your site is static (no adapter, output in dist/) or SSR (the @astrojs/node adapter). Then connect the GitHub repository, run npm run build, and either serve dist/ with Nginx or start node ./dist/server/entry.mjs behind a reverse proxy. Every push can then redeploy the site.
Most Astro deploy guides send you to a serverless platform and stop there. That is fine until you want your site on a server you control, next to your other sites, with no per-request billing to think about. If you are new to the framework, our beginner’s guide to Astro JS covers islands, content collections and SSR first.
This guide covers the part those guides skip: how to tell which Astro build you have, what each adapter changes on a real server, what you give up when you leave a serverless adapter behind, and how to fix the build and 404 problems that show up after the move.
TL;DR
Short on time? Here is the whole guide in a few lines:
- Check your adapter first. No adapter means a static site.
@astrojs/nodemeans SSR. A Vercel, Netlify or Cloudflare adapter means the site was set up for that platform. - A static Astro site is just files.
npm run buildwrites them todist/, and any web server can serve that folder. - SSR on your own server needs
@astrojs/nodein standalone mode, started withnode ./dist/server/entry.mjsbehind a reverse proxy. - On xCloud, the detection is automatic. xCloud reads
package.json, labels the repo Astro, and fills in static or SSR settings for you. - Serverless adapters are removed at deploy on xCloud and the site builds as static. Your repository stays as it is.
- The most common surprise after the move is the 404 page, not the build. Test a URL that doesn’t exist before you switch DNS.
What xCloud Reads in Your Repo (and Why It Matters)
Here is the finding this guide is built on: you don’t have to tell xCloud whether your Astro site is static or SSR. xCloud’s Git deploy reads the dependencies in your package.json and picks the serving mode from the adapter it finds. This table is taken from the detection rules in xCloud’s code:
Your package.json has |
Serving mode xCloud picks | Build | What runs |
|---|---|---|---|
| No adapter | Static build | npm run build |
Nginx or OpenLiteSpeed serves dist/ |
@astrojs/node |
SSR (Node process) | npm run build |
node ./dist/server/entry.mjs |
@astrojs/vercel, @astrojs/netlify or @astrojs/cloudflare |
Static build | Adapter removed on the server, then npm run build |
Your web server serves dist/ |
No build script |
Static or SSR, as above | None until you set one | xCloud warns: “No build script found in package.json — set the build command.” |
In every case the App Type is Node.js, because Astro builds with Node.js even when the finished site is plain HTML.
If you only remember one line: the adapter decides the deploy, not the hosting plan. Get that right in astro.config.mjs and the rest is settings.

Static or SSR: Which Astro Build Do You Have?
Astro prerenders your whole site by default. In Astro’s own words on its on-demand rendering guide, “By default, your entire Astro site will be prerendered”, and “To render any page on demand, you need to add an adapter.”
Open astro.config.mjs and package.json and look for two things:
- An
adapter:line in the config, and the matching@astrojs/*package in dependencies. - Pages that render on request:
export const prerender = falsein a page, oroutput: 'server'in the config.
You need SSR if your site uses any of these
| Feature | Needs an adapter? |
|---|---|
| Pages built once at build time (blogs, docs, marketing pages) | ❌ No |
Pages with export const prerender = false |
✅ Yes |
| Server endpoints (API routes) that run on request | ✅ Yes |
| Astro Actions (form handling on the server) | ✅ Yes |
| Sessions | ✅ Yes |
Server islands (server:defer) |
✅ Yes |
Here is the part that trips people up: output: 'server' does not add features by itself. Astro’s docs say it “only switches the default rendering behavior”, so every page renders on request unless you mark it prerender = true. A content site that never needed request-time rendering is usually better off static.
Rule of thumb: if you can’t name a page that must be fresh on every request, deploy it static. Static needs fewer server resources, loads faster and has fewer moving parts.
What You Need Before You Deploy
- Your Astro project in a Git repository (GitHub, GitLab or Bitbucket). Public repositories work as they are. For a private one, connect your Git provider first.
- A
buildscript inpackage.json, such as"build": "astro build". New Astro projects have one. - A server with the Nginx or OpenLiteSpeed stack. You can create one during setup.
- A supported Node.js version. Astro lists its current minimum on its install and setup page, and odd-numbered releases are not supported. To change it on your server, see how to change the Node version with xCloud.
- A domain, or start on the free staging domain and add yours later.
Deploy a Static Astro Site From GitHub
The DIY way (any VPS)
On a plain server you build the site and point a web server at the output:
git clone https://github.com/you/your-astro-site.git
cd your-astro-site
npm ci
npm run build # writes the site to dist/
Then serve dist/ with Nginx. The try_files line returns a real 404 for missing pages instead of the homepage:
server {
listen 80;
server_name example.com;
root /var/www/your-astro-site/dist;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
}
That works, but now you own the SSL certificate, the rebuild on every push, and the 3 a.m. “why is the site serving last week’s build” question.
The xCloud way
- Open Sites → Add New Site and click the Astro card, then pick your server.
- Paste or search for your repository. xCloud shows Native app with an Astro label and App Type: Node.js.
- Keep the free Staging domain to test, or choose Use a live domain instead. Check the Branch.
- Under Build & serving, confirm Serving mode: Static build and Web root:
dist. Change the web root only if you set a differentoutDir. - Click Deploy. When it finishes, Deployments shows the build as Deployed and LIVE.

👉 Every screen, with screenshots: How to deploy an Astro site from Git on xCloud. For plain HTML or other static generators, see auto-deploy a static website from GitHub. For plans and what is included, see static site hosting on xCloud.
Deploy Astro SSR With @astrojs/node
If your site needs request-time rendering on your own server, use the official Node adapter. Add it with one command:
npx astro add node
Then check that the adapter runs in standalone mode:
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
});
According to the @astrojs/node guide, standalone mode “builds a server that automatically starts when the entry module is run”, and it serves the files in dist/client/ itself. The other mode, middleware, is for mounting Astro inside an existing Express or Fastify app.
What a self-managed SSR server needs
On a plain VPS, you start the server with the host and port it should listen on, and put Nginx in front of it for HTTPS:
HOST=127.0.0.1 PORT=4321 node ./dist/server/entry.mjs
You also need a process manager to keep it running after a crash or reboot, and a restart after every deploy. Two more details from the adapter docs are worth knowing: the adapter does not load .env files on its own, and sessions use the local filesystem by default.
What xCloud sets up for you
When @astrojs/node is in your dependencies, xCloud sets Serving mode: SSR (Node process), Start command: node ./dist/server/entry.mjs and a Port (3000 by default). xCloud runs the process for you, passes it the site’s port and host so the web server can reach it, applies the site’s .env values, and restarts it after each deploy.

👉 For Node.js apps in general, read how to deploy a Node.js application.
Moving From Vercel, Netlify or Cloudflare Adapters
You don’t need to rewrite your project to try it on your own server. When xCloud finds @astrojs/vercel, @astrojs/netlify or @astrojs/cloudflare (and no @astrojs/node), it shows this warning on the setup screen:
This Astro app targets a serverless platform; its adapter is removed at deploy so it builds as a static site.
The adapter is removed from the server’s copy during each deploy, never from your repository. So the same repo can still deploy to your old platform while you test.
The trade-off is honest and worth checking page by page:
| Your site uses | After the move without changes | What to do |
|---|---|---|
| Only prerendered pages | ✅ Works as a static site | Nothing |
prerender = false pages, API routes, Actions, sessions or server islands |
❌ No request-time rendering in a static build | Switch to @astrojs/node, push, add the repo again |
| Platform-only APIs (for example Cloudflare bindings or Vercel-specific features) | ❌ Not available on your own server | Replace them with a Node.js equivalent, or keep that part on the platform |
This is where most moves go wrong: a site that “just added the adapter because the host said so” moves in minutes, while a site with a contact form built on Actions needs the Node adapter first.
Push to Deploy, Environment Variables, Domain and SSL
- Push to deploy: turn on Auto-deploy on push (webhook) for repos from a connected Git provider. Each push to the branch rebuilds the site. Deploy Now redeploys without a push. See One Click Git Deployment for the full flow.
- Environment variables: add them under Advance → Environment file (.env), not in your repo. A static site reads them at build time, so deploy again after you change one. 👉 Environment variables and Git deployments in xCloud
- Domain and SSL: start on the staging domain, then add your own domain, point DNS at the server, and xCloud issues a free SSL certificate. 👉 Deploy Git projects in one click with xCloud

Troubleshooting Failed Astro Builds
Start with the deployment log: open the failed deployment under Deployments and read Build steps to see which step stopped. Then match the symptom:
| Symptom | Likely cause | Fix |
|---|---|---|
| Build stops at “No build script found” | package.json has no build script |
Add "build": "astro build" or set the build command |
| Build fails on install or with a syntax error that works locally | Node.js version on the server is older than Astro needs | Change the site’s Node version, then deploy again |
| Static deploy fails after the build step | The build wrote no index.html to the web root |
Check Web root matches your outDir |
| Missing pages show the homepage with status 200 | Web server falls back to index.html |
Add a 404 rule (below) |
| SSR deploy says the app isn’t listening on its port | The app ignores the PORT and HOST it was given |
Keep the standalone adapter and the default start command; don’t hardcode a port or localhost |
| A push doesn’t start a deploy | Webhook not set up or branch mismatch | See the troubleshooting guide below |
The 404 problem nobody warns you about
This one comes from our support desk rather than the build log. On static multi-page sites, a URL that doesn’t exist can return the homepage with HTTP 200 instead of your 404.html with HTTP 404. Visitors see a working page, and search engines see copies of your homepage at every broken link.
On an xCloud NGINX site, the fix is a custom rule. Go to Tools → Nginx Customization, choose Use My Own Config and Inside Server Block, and add:
if (!-e $request_filename) { return 404; }
error_page 404 /404.html;
Make sure 404.html exists in dist/ (Astro writes it when you have src/pages/404.astro). Click Run & Debug to validate, then Save Config. 👉 How to add custom NGINX rules in xCloud
For stuck or untriggered deploys, see troubleshooting Git deployments and why your Git deploy failed on xCloud.
What xCloud Does (and Doesn’t Do) for Astro
xcloud.host itself is built with Astro, so this is a workflow we use, not a theory. Here is the honest split:
| ✅ What xCloud does | ❌ What it doesn’t do |
|---|---|
| Detects Astro and picks static or SSR from your adapter | Run serverless or edge functions: SSR runs as one Node process on your server |
| Builds on every push and lists each deployment with its build steps | Keep Vercel, Netlify or Cloudflare adapter features: they are removed and the site builds static |
| Runs and restarts the Node process for SSR sites | Change your repository: switching to @astrojs/node is your commit |
| Free SSL, your own domain, staging domain to test | Serve from many regions by default: your site lives where your server is (put a CDN in front if you need that) |
To undo a move, nothing in your repo has changed, so you can point DNS back to your old platform at any time.
Run Astro on a server you control
- Connect your repository and let xCloud detect Astro.
- Check Build & serving: static with
dist, or SSR with the Node start command. - Deploy to the staging domain, test a missing URL for a real 404, then add your domain.
Ready to ship? See Astro hosting on xCloud or start with Node.js Hosting. Picking a content backend first? Our list of the best CMS for Astro shows which ones rebuild your site on publish.
Ship Your Astro Site to Your Own Server This Week
Still choosing a framework? Astro vs Next.js compares the two by what each one runs on your server. The deploy is the easy part once you know which Astro build you have. Check the adapter, decide static or SSR on purpose, and let the build settings follow from that choice.
This week, open astro.config.mjs, confirm the adapter matches what your pages need, deploy to a staging domain, and request a URL that doesn’t exist. If it returns a real 404, you are ready to switch DNS.
If you have found this blog helpful, feel free to subscribe to our blogs for valuable tutorials, guides, knowledge, and tips on web hosting and server management. You can also join our Facebook community to share insights and engage in discussions.
Frequently Asked Questions
Do I need an adapter to deploy Astro?
Only if any page or endpoint renders on request. A fully static Astro site needs no adapter: astro build writes plain files to dist/ and any web server can serve them. Server endpoints, actions, sessions, server islands and pages with prerender = false need an adapter, such as @astrojs/node on your own server.
Can I deploy Astro to a VPS without Vercel or Netlify?
Yes. A static build is a folder of HTML, CSS and JavaScript that Nginx can serve. An SSR build with @astrojs/node in standalone mode is a Node.js server you start with node ./dist/server/entry.mjs behind a reverse proxy. xCloud sets up either one from your Git repository.
What happens to my Vercel, Netlify or Cloudflare adapter on xCloud?
xCloud removes it on the server during each deploy and builds the site as static, and it shows a warning on the setup screen saying so. Your repository is not changed. If the site needs server rendering, switch to @astrojs/node.
Why does my static Astro site show the homepage instead of a 404 page?
The web server is falling back to index.html for URLs that don’t exist. On an xCloud NGINX site, add a rule in Tools → Nginx Customization that returns 404 for missing files and points error_page at /404.html, then check it with Run & Debug before you save.
How do I update an Astro site after the first deploy?
Push to the branch you deployed. With Auto-deploy on push turned on, xCloud pulls the new code, runs the build again and, for SSR sites, restarts the Node process. You can also click Deploy Now on the site.
