Deploy a Node.js App on a VPS in India: Production Guide

From zero to production: deploy a Node.js application on an Indian VPS with PM2, Nginx reverse proxy, SSL certificates, and performance monitoring. Step-by-step with code examples.

Deploy a Node.js App on a VPS in India: Production Guide

Deploying Node.js to Production on an Indian VPS

Running your Node.js application on a VPS gives you full control over performance, security, and cost. This guide walks you through a production-ready deployment on an Indian VPS.

Prerequisites

  • A KVM VPS with Ubuntu 22.04+ (we'll use a Botnix Cloud VPS in Mumbai)
  • A domain name pointed to your server's IP
  • Basic terminal/SSH knowledge

Step 1: Initial Server Setup

# Update system
sudo apt update && sudo apt upgrade -y

# Create a non-root user
sudo adduser deploy
sudo usermod -aG sudo deploy

# Set up SSH key authentication
ssh-copy-id deploy@your-server-ip

# Disable password authentication (security)
sudo nano /etc/ssh/sshd_config
# Set: PasswordAuthentication no
sudo systemctl restart sshd

Step 2: Install Node.js via NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 20
node -v  # Should show v20.x.x

Step 3: Set Up Your Application

# Clone your project
git clone https://github.com/your-repo/your-app.git
cd your-app

# Install dependencies
npm ci --production

# Create environment file
cp .env.example .env
nano .env  # Configure your production variables

Step 4: Process Management with PM2

PM2 keeps your app running, handles restarts, and provides monitoring:

npm install -g pm2

# Start your application
pm2 start app.js --name "my-app" -i max

# Auto-start on server reboot
pm2 startup
pm2 save

# Useful PM2 commands
pm2 logs my-app     # View logs
pm2 monit            # Real-time monitoring
pm2 restart my-app   # Restart

Step 5: Nginx Reverse Proxy

sudo apt install nginx -y

# Create Nginx config
sudo nano /etc/nginx/sites-available/my-app
server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
}
sudo ln -s /etc/nginx/sites-available/my-app /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Step 6: SSL with Let's Encrypt

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Certbot automatically configures Nginx for HTTPS and sets up auto-renewal.

Step 7: Firewall Configuration

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable

Step 8: Performance Monitoring

Set up basic monitoring:

# Install htop for system monitoring
sudo apt install htop -y

# PM2 built-in monitoring
pm2 install pm2-logrotate  # Prevent log files from filling disk

# Optional: Set up PM2 Plus for web-based monitoring
pm2 link YOUR_SECRET_KEY YOUR_PUBLIC_KEY

Production Checklist

  • ✅ Non-root user with SSH key authentication
  • ✅ Node.js installed via NVM (easy version management)
  • ✅ PM2 for process management and auto-restart
  • ✅ Nginx reverse proxy with proper headers
  • ✅ SSL/TLS via Let's Encrypt
  • ✅ UFW firewall configured
  • ✅ Log rotation enabled
  • ✅ Environment variables secured

Why an Indian VPS?

Deploying on a Mumbai VPS means your API responses reach Indian users in under 10ms instead of 200ms+ from US servers. For real-time applications (chat, gaming, live updates), this difference is transformative.

Botnix Cloud VPS plans include KVM isolation, NVMe storage, DDoS protection, and 24/7 support — everything you need for a production Node.js deployment. Starting at ₹400/month.

Deploy your server in under 3 minutes

KVM VPS from ₹400/mo. Mumbai datacenter, NVMe storage, DDoS protection, and 24/7 support from real engineers.

Deploy Now — Free Setup