Back to Home

Astro 6 SSG on VPS: site stack 2026

Case of static bilingual site on Astro 6 SSG with Nginx on VPS. Described stack, i18n, SEO infrastructure, analytics with consent, TypeScript strict. Detailed breakdown of configurations and limitations for senior developers.

How to build a site on Astro 6 + VPS for 300r
Advertisement 728x90

Static Site Architecture with Astro 6 and VPS in 2026

The "Na Derevo" website uses Astro 6 in SSG mode to generate clean static files: the project homepage, the MENO product landing page, and a blog. Bilingual support (ru/en) is implemented without SPA or SSR. On the server—Nginx on a VPS for 300 rubles, SSL via Certbot. Analytics—Yandex.Metrica with a consent mechanism.

The stack is minimized for performance:

  • Framework: Astro 6 (SSG)
  • Language: TypeScript (strict)
  • Content: Astro Content Collections + Markdown/MDX
  • Server: Nginx
  • SSL: Certbot (Let's Encrypt)
  • Analytics: Yandex.Metrica (optional)

Astro generates a dist folder with HTML, CSS, JS—no Node.js in production. Nginx serves files directly, which is faster than SSR.

Google AdInline article slot

Localization and URL Structure

Astro configuration for i18n:

locales: ['ru', 'en'],
prefixDefaultLocale: true,
redirectToDefaultLocale: false

Structure:

  • naderevo.com/ru/ — homepage (RU)
  • naderevo.com/en/ — homepage (EN)
  • naderevo.com/ru/blog/ — blog (RU)
  • naderevo.com/en/blog/ — blog (EN)
  • naderevo.com/ — redirect page (noindex)

The root determines language via localStorage, cookie, or Accept-Language and redirects. Prefixing both languages simplifies hreflang and canonical. Content Collections ensure frontmatter typing—the build fails if fields are missing.

Google AdInline article slot

SEO Infrastructure

Each page includes:

  • Basic tags: canonical, hreflang (incl. x-default), Open Graph, Twitter Card.
  • Structured Data: JSON-LD in <head> (WebSite for homepage, SoftwareApplication for landing page, BlogPosting for articles).
  • Sitemap: generated by @astrojs/sitemap with a filter for utility pages.
  • robots.txt:
User-agent: *
Allow: /
Sitemap: https://naderevo.com/sitemap-index.xml

Open to AI crawlers. astro.config.mjs sets site: 'https://naderevo.com' for absolute URLs in sitemap/OG.

Deployment and Server Configuration

VPS serves static files via Nginx. Why not Vercel/Netlify: full control over redirects, headers, no vendor lock-in.

Google AdInline article slot

Redirects in nginx.conf:

# http -> https
server {
    listen 80;
    return 301 https://$host$request_uri;
}

# www -> apex
server {
    server_name www.naderevo.com;
    return 301 https://naderevo.com$request_uri;
}

Asset caching:

Cache-Control: public, max-age=31536000, immutable

Hashes in file names (Astro) invalidate cache on deploy.

Security headers:

X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin

SSL auto-updates with Certbot. Legacy redirects for old post slugs.

Privacy-Focused Analytics

Yandex.Metrica loads after consent. Cookie banner saves choice in cookie/localStorage. If declined:

  • Script does not load.
  • Analytics cookies are cleared.

Goals via data-metrika-goal. ID from PUBLIC_YANDEX_METRIKA_ID—optional for dev.

Webvisor/clickmap disabled to reduce load.

TypeScript and Configuration

tsconfig.json:

{
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Strict mode catches errors in components, collections, i18n configs.

Implementation Limitations

  • Redirect page / (noindex)—SEO compromise: weight goes to /ru/, /en/.
  • Universal OG image for all pages (unique ones planned).
  • No session recording in Metrica.

Key Takeaways

  • Astro SSG + Nginx—maximum speed and reliability for static sites.
  • Full content typing via Content Collections.
  • SEO-ready: hreflang, JSON-LD, open robots.txt.
  • Privacy: analytics only with consent.
  • VPS cheaper than PaaS, full config control.

— Editorial Team

Advertisement 728x90

Read Next