Next.js hosting runs applications built with the popular React framework, including server-side rendering, static generation, API routes and middleware. Because Next.js combines static and dynamic features, the hosting must support a Node.js server for anything beyond fully static exports. Self-hosting Next.js on a VPS gives you full control, predictable costs and smooth deployments for modern web applications.
Deployment options
Next.js offers several output modes. A static export produces plain files that any web server can serve, suitable for marketing sites without server features. The standalone output creates a minimal Node.js server with only the dependencies needed, ideal for running on a VPS or in Docker. Full server mode supports incremental static regeneration, server actions, API routes and middleware.
- Static export for simple sites on cPanel hosting
- Standalone output on a VPS with Node.js
- Docker images for consistent deployments
- PM2 or systemd to keep the server running
Setting up a production server
Build the application in CI or on the server with next build, then run it with node server.js from the standalone output under PM2 or systemd. Put Nginx or Caddy in front for TLS, compression and caching of static assets in the _next/static directory, which can be cached for a long time because file names include hashes. Configure environment variables for API keys and database connections securely.
Performance tuning
Use static generation for pages that rarely change and incremental regeneration for pages that change periodically. Cache data fetching appropriately. Optimise images with the built-in image component, and make sure the server has enough memory for image optimisation, which can be CPU and RAM intensive. Scale across CPU cores by running multiple instances behind the reverse proxy.
Caching and ISR on self-hosted servers
When running several instances, configure a shared cache handler, for example with Redis, so regenerated pages are consistent across instances. On a single server, the default file system cache works well.
Security and updates
Keep Next.js and dependencies updated, as framework security fixes are released regularly. Never expose server-only secrets in client components, validate input in server actions and API routes and set security headers.
Choosing a plan
Small Next.js sites run on entry-level VPS plans. Larger applications with image optimisation and many users need more RAM and CPU. Compare the VPS plans below.