[{"data":1,"prerenderedAt":129},["ShallowReactive",2],{"seo-verification":3,"blog-deploying-an-astro-application-on-a-vps-en":6},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"id":7,"slug":8,"slugs":9,"title":12,"excerpt":13,"readTime":14,"views":15,"isPinned":16,"publishedAt":17,"category":18,"categories":24,"featuredImage":26,"bgImage":27,"posterImage":28,"relatedSolution":29,"intro":32,"sections":33,"ctaTitle":79,"ctaBody":80,"ctaButton":81,"ctaUrl":82,"relatedPosts":83},52,"deploying-an-astro-application-on-a-vps",{"fr":10,"en":8,"ar":11},"deployer-astro-vps","نشر-تطبيق-astro-على-خادم-vps","Deploying an Astro application on a VPS","Deploy an Astro site on a Cloud VPS: static build or SSR via the Node adapter, Docker, Nginx and SSL. A guide for front-end developers.",3,0,false,"2026-04-29T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},4,"Development","developpement","bg-warning\u002F10 text-warning","dev",[25],{"id":19,"name":20,"slug":21,"color":22,"icon":23},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fdeployer-astro-vps-poster.svg",{"categorySlug":30,"appSlug":31},"development","astro-stack","Astro generates a fully static site by default — nothing to execute on each visit — but it can also render pages server-side via its Node adapter. Depending on your need, you serve simple HTML files or a real SSR server. Here are both approaches on a VPS, with a reverse proxy and cache.",[34,38,48,51,73,76],{"type":35,"title":36,"body":37},"h2","Why self-host Astro on a VPS","Astro has a peculiarity: it can produce either a 100% static site (`output: 'static'`), or an application with on-demand server rendering (`output: 'server'` via `@astrojs\u002Fnode`). This duality makes the VPS very relevant. In static mode, you serve HTML files directly from Nginx, without any Node process: maximum performance and minimal footprint. In SSR, you launch a Node server that renders pages dynamically, useful for personalized content or integrated API endpoints. On a VPS, you choose your strategy without being locked into the model imposed by a front-end deployment platform. You also control the HTTP cache, the security headers and Brotli compression, where front-end hosts handle that as a black box.",{"type":39,"title":40,"items":41},"ul","Concrete benefits",[42,43,44,45,46,47],"Freedom of output mode: pure static or SSR Node, or even hybrid per route","In static mode, Nginx serves the files without any Node process: nothing to execute per request","Full control of the HTTP cache, security headers (CSP, HSTS) and Brotli compression","No bandwidth limit or request quota imposed by a front-end platform","Astro API endpoints hosted on the same domain, without a third-party serverless function","Reproducible deployment via Docker: the same build locally and in production",{"type":35,"title":49,"body":50},"Hardware and software prerequisites","A static Astro site fits on the smallest VPS imaginable: 1 vCPU and 1 GB of RAM is more than enough, since Nginx only serves files. In SSR mode, plan for 2 GB for the Node process and rendering peaks. Install Node.js 20 LTS to build (or build in CI), Docker if you containerize, and Nginx as a front end. Point `mydomain.com` and `www.mydomain.com` at the VPS IP. Count 5 GB of disk; the `dist\u002F` folder of a static site generally weighs a few MB.",{"type":52,"title":53,"steps":54},"steps","Step-by-step deployment",[55,58,61,64,67,70],{"title":56,"body":57},"Choose the output mode","In `astro.config.mjs`, set `output: 'static'` for a content site, or `output: 'server'` with `adapter: node({ mode: 'standalone' })` if you need SSR. This choice conditions the whole rest of the deployment.",{"title":59,"body":60},"Build the application","Run `npm run build`. In static mode, you get a `dist\u002F` folder containing the HTML, CSS and JS ready to serve. In SSR, you additionally get a `dist\u002Fserver\u002Fentry.mjs` to run with Node.",{"title":62,"body":63},"Serve the static files with Nginx (static mode)","Point your vhost's `root` directive at `\u002Fvar\u002Fwww\u002Fastro\u002Fdist` and enable `try_files $uri $uri\u002F \u002F404.html;`. Add `gzip on;` and long `Cache-Control` headers on versioned assets. No container is needed.",{"title":65,"body":66},"Containerize the Node server (SSR mode)","For SSR, create a Dockerfile based on `node:20-alpine` that copies `dist\u002F` and runs `node .\u002Fdist\u002Fserver\u002Fentry.mjs`. Expose port 4321 and start with `docker compose up -d`. Nginx will then do a `proxy_pass` to this port.",{"title":68,"body":69},"Configure the reverse proxy and compression","Whether you are in static mode or in SSR behind Node, declare the Nginx vhost with `www` redirected to the apex domain. Enable Brotli if the module is available for assets even lighter than gzip.",{"title":71,"body":72},"Enable SSL","Run `certbot --nginx -d mydomain.com -d www.mydomain.com`. Force the redirect to HTTPS and add the `Strict-Transport-Security` header. Validate the deployment with a Lighthouse test from your browser.",{"type":74,"body":75},"tip","Even for an SSR site, leverage Astro's hybrid rendering: mark static pages with `export const prerender = true` so they are generated at build time and served directly by Nginx, reserving the Node process only for genuinely dynamic routes. This drastically reduces the server load. And place an Nginx `proxy_cache` in front of low-change-frequency SSR pages to absorb traffic spikes.",{"type":35,"title":77,"body":78},"Deploy Astro in One Click from the Marketplace","The ServOrbit Marketplace offers an **Astro Stack** template that automatically configures Node.js LTS, PM2, and Nginx on your VPS. In a few minutes, your production environment is ready to host your Astro application — in static or SSR mode — with no manual setup.\n\nCompared to the installation described in this guide, the template handles the initial setup and lets you jump straight to the \"build your app and transfer it\" step.","Your Astro Environment Ready in Minutes","The Astro Stack template automatically configures Node.js LTS, PM2, and Nginx — ready to host your Astro application in static or SSR mode.","Deploy My Astro Stack","\u002Fmarketplace\u002Fdevelopment\u002Fastro-stack",[84,99,114],{"id":85,"slug":86,"slugs":87,"title":90,"excerpt":91,"readTime":19,"views":15,"isPinned":16,"publishedAt":92,"category":93,"categories":94,"featuredImage":26,"bgImage":27,"posterImage":96,"relatedSolution":97},5,"deploying-laravel-on-a-vps-a-production-guide",{"fr":88,"en":86,"ar":89},"deployer-laravel-vps","نشر-laravel-على-خادم-vps-دليل-الإنتاج","Deploying Laravel on a VPS: a production guide","Take Laravel to production on a VPS: PHP, workers, cache, database, reverse proxy and HTTPS configured cleanly.","2026-02-09T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[95],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-laravel-vps-poster.svg",{"categorySlug":23,"appSlug":98},"laravel-stack",{"id":100,"slug":101,"slugs":102,"title":105,"excerpt":106,"readTime":14,"views":15,"isPinned":16,"publishedAt":107,"category":108,"categories":109,"featuredImage":26,"bgImage":27,"posterImage":111,"relatedSolution":112},43,"deploy-a-nodejs-application-on-a-vps",{"fr":103,"en":101,"ar":104},"deployer-nodejs-vps","نشر-تطبيق-nodejs-على-vps","Deploy a Node.js Application on a VPS","Deploy a Node.js application to production on a VPS: PM2, Nginx reverse proxy, Let's Encrypt SSL, and automatic startup at boot.","2026-05-08T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[110],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-nodejs-vps-poster.svg",{"categorySlug":30,"appSlug":113},"nodejs-stack",{"id":115,"slug":116,"slugs":117,"title":120,"excerpt":121,"readTime":14,"views":15,"isPinned":16,"publishedAt":122,"category":123,"categories":124,"featuredImage":26,"bgImage":27,"posterImage":126,"relatedSolution":127},44,"deploy-a-django-application-on-a-vps",{"fr":118,"en":116,"ar":119},"deployer-django-vps","نشر-تطبيق-django-على-vps","Deploy a Django Application on a VPS","Deploy Django on a VPS: Gunicorn, Nginx, PostgreSQL, Docker, and SSL. A complete guide for Python developers who want to self-host.","2026-05-07T00:00:00+00:00",{"id":19,"name":20,"slug":21,"color":22,"icon":23},[125],{"id":19,"name":20,"slug":21,"color":22,"icon":23},"\u002Fblog\u002Fcovers\u002Fdeployer-django-vps-poster.svg",{"categorySlug":30,"appSlug":128},"django",1787580996610]