Docs / Programming & Development / How to Deploy an Astro Static Site on a VPS

How to Deploy an Astro Static Site on a VPS

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 26 views · 1 min read

What Is Astro?

Astro is a modern static site generator that ships zero JavaScript by default, producing fast, lightweight websites. Deploying an Astro site on your Breeze is straightforward since the build output is plain HTML, CSS, and JavaScript files served directly by Nginx.

Prerequisites

  • A Breeze running Ubuntu 22.04 or later
  • Node.js 18+ installed locally or on the server
  • Nginx installed on your Breeze

Step 1: Build the Site

Build the Astro project either locally or on your Breeze:

cd /var/www/astro-site
npm install
npm run build

This generates the dist/ directory containing all static assets.

Step 2: Configure Nginx

server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/astro-site/dist;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|svg|ico|woff2)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }
}
sudo ln -s /etc/nginx/sites-available/astro /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 3: Enable SSL

sudo certbot --nginx -d yourdomain.com

Step 4: Automate Deployments

Create a simple deployment script:

#!/bin/bash
cd /var/www/astro-site
git pull origin main
npm install
npm run build
sudo systemctl reload nginx

SSR Mode

If you need server-side rendering, install @astrojs/node and run the output with PM2 behind Nginx, similar to a Next.js deployment.

Was this article helpful?