Every website either serves pre-built files (static) or generates pages on request (dynamic) — or mixes both. The choice affects speed, security, hosting cost and how content gets edited.
Definitions
Static site: HTML, CSS and JavaScript files built ahead of time — by hand or with a static site generator (Astro, Hugo, Eleventy, Jekyll, Next.js export). The web server simply sends files. No database or server-side code runs per request.
Dynamic site: each request runs code on the server — PHP, Node.js, Python, Ruby — usually querying a database to build the page. WordPress, Laravel apps, Django sites, online shops.
Comparison
| Static | Dynamic | |
|---|---|---|
| Speed | Extremely fast; trivial to cache and put on a CDN | Depends on code, database and caching |
| Security | Very small attack surface — no server code or database to exploit | More components to patch and protect |
| Hosting resources | Minimal | CPU, RAM and a database |
| Scaling | Effortless | Needs caching, more servers |
| Content editing | Edit files or a headless CMS, then rebuild | Edit in an admin panel, live immediately |
| Personalisation, logins, carts | Via client-side JS and external APIs | Native |
| Search, forms, comments | External services or small APIs | Built in |
| Build step | Required on every content change | None |
When static wins
- Marketing sites, landing pages, documentation, portfolios, blogs.
- Sites where content changes a few times a day or less.
- Projects where speed and security matter more than in-browser editing.
- High-traffic pages that must survive spikes on modest hardware.
When dynamic wins
- Online stores, membership sites, forums, booking systems.
- Content that changes constantly or per user.
- Non-technical editors who expect a WYSIWYG admin with instant publishing.
- Complex search, filtering and user-generated content.
Hybrids: the best of both
The line has blurred:
- Static + headless CMS — editors use a CMS (Strapi, Directus, WordPress as headless); a webhook triggers a rebuild and deploy.
- Static + APIs (“Jamstack”) — static pages with dynamic parts (forms, search, comments, auth) handled by small APIs or services. See Jamstack explained.
- Incremental / on-demand rendering — frameworks like Next.js, Nuxt and Astro pre-render most pages and render others on request, caching results.
- Dynamic with full-page caching — WordPress behind a page cache or Nginx FastCGI cache serves most visitors static HTML while staying fully dynamic for editors and logged-in users.
Cost and hosting
A static site needs only a web server — Nginx on the smallest VPS serves thousands of requests per second. A dynamic site needs RAM for PHP or Node workers and a database; a small WordPress site runs well on 1–2 GB, busy stores need more. See how much RAM a VPS needs.
Decision checklist
- Do pages differ per user (logins, carts, dashboards)? → dynamic (or hybrid).
- Will non-technical people publish frequently and expect instant changes? → dynamic CMS, or static + CMS with automatic rebuilds.
- Is it mostly content that rarely changes? → static.
- Is security maintenance a concern with little admin time? → static.
- Expect traffic spikes? → static, or dynamic with aggressive caching.
Getting started
- Static: deploy an Astro/static site with Nginx, static site generators compared.
- Dynamic: WordPress with Nginx, Laravel, Django.
A single VPS can host both — static marketing pages and a dynamic app side by side — which is one of the advantages of running your own server.