How to Deploy a Next.js and Node.js Application on a VPS

Short answer
Deploying Next.js and Node.js on your own VPS gives fixed monthly costs, full data ownership and no serverless cold starts. The production stack is Ubuntu with Nginx as reverse proxy, PM2 to keep the Node process alive and restart it on boot, and Let's Encrypt for automatically renewed TLS certificates.
Deploying Next.js and Node.js on your own VPS gives you fixed monthly costs, full data ownership, and no serverless cold starts. This is the exact production stack TechDino uses to deploy client applications: Ubuntu + Nginx + PM2 + Let's Encrypt. Here is the complete process.
1. Prepare the Server
Create a non-root deploy user, enable the firewall (allow OpenSSH, 'Nginx Full'), and point your domain's A record at the server IP before continuing.
2. Build the Application
3. Run It Under PM2
PM2 restarts crashed processes, keeps logs (pm2 logs), and survives server reboots — the minimum bar for production Node hosting.
4. Nginx Reverse Proxy
5. Free SSL with Let's Encrypt
6. Updating Without Downtime
Production Checklist
- Environment variables set on the server, never committed to git.
- Database backups scheduled (cron + off-server storage).
- pm2 save run after any process changes.
- Firewall allows only 22/80/443.
- Monitoring: pm2 monit locally, uptime checks externally.
Before You Go Live
The deployment works long before it is production-ready. These are the steps that separate a running app from a maintainable one:
- Set PM2 to start on boot (`pm2 startup` then `pm2 save`), or a reboot silently takes the site down.
- Confirm the Let's Encrypt renewal timer is active — certificates expire in 90 days and expiry always happens at an inconvenient moment.
- Keep secrets in environment files outside the repository, readable only by the service user.
- Enable gzip or brotli in Nginx. It is a one-line change with a measurable effect on load time.
- Set cache headers for static assets so browsers stop re-fetching them.
- Configure a firewall allowing only 22, 80 and 443, and put SSH on key authentication.
Backups and Recovery
A backup that has never been restored is a hypothesis. Schedule database dumps and uploaded-file backups to off-server storage, keep enough history to survive a problem discovered late, and restore one to a scratch server at least once so you know the procedure and how long it takes.
Knowing When It Breaks
- External uptime monitoring — the server cannot tell you it is down.
- Disk space alerts. Logs filling the disk is the most common self-inflicted outage.
- PM2 log rotation, for the same reason.
- Application error tracking, so failures surface before a user reports them.
- A scheduled window for OS and dependency security updates, rather than deferring them indefinitely.
When a VPS Is the Wrong Choice
A VPS gives fixed costs, full data control and no cold starts — but you own the operations. If nobody will handle patching, monitoring and restores, a managed platform is more honest about the trade-off. The comparison is between predictable cost with your maintenance, and higher variable cost with someone else's. Pick based on whether that maintenance owner actually exists.
See deployment options for how TechDino deployments are structured, and support and maintenance for what ongoing ownership involves.
Prefer not to run servers yourself? TechDino includes deployment and maintenance with every ready-made product — VPS setup, SSL, monitoring, and updates handled for you. Get in touch.
Frequently Asked Questions
VPS vs Vercel/serverless — which should I choose?
VPS wins for fixed costs, self-owned data, and long-running processes (queues, sockets). Managed platforms win for zero-ops teams and traffic spikes. Business apps with steady traffic usually run cheapest on a VPS.
What VPS size do I need?
A typical business application (Next.js + Node API + MySQL) starts comfortably on 2 vCPU / 4 GB RAM. Scale when metrics — not fear — say so.
Can TechDino deploy my application for me?
Yes. VPS deployment with Nginx, PM2, SSL, and backups is part of our delivery for every product and custom project — see our deployment and maintenance service.
Explore Next
- See our ready-made white-label software products
- Learn about our custom software development with deployment support
Need Setup or Custom Coding?
Get in touch to rebrand or customize our ready-made products, or discuss custom development services. All quotes are customized and private.
Related Articles
Self-Hosted Software vs Monthly Cloud SaaS: Why Businesses are Reclaiming Data Sovereignty
A deep analysis of self-hosted software on private VPS vs monthly rental SaaS: complete data control, zero recurring inflation, and source-code rights.
How to Automate Inbound Lead Qualification with Conversational AI Agents
Learn how autonomous AI agents replace static web forms to qualify inbound leads 24/7, verify budgets, score intent, and sync records into your CRM.