You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
π This installs all required packages & starts NGINX.
β Step 3: Upload Your Projects (Drag & Drop)
In VS Code, open /var/www/ folder.
Drag your project folders here:
Project
Upload To
Frontend (React)
/var/www/frontend
Backend (Node.js)
/var/www/backend
Dashboard (React)
/var/www/dashboard
Then go inside each folder and run:
npm install
β Step 4: Run Projects Using PM2
cd /var/www/frontend
pm2 start npm --name frontend -- start
cd /var/www/backend
pm2 start npm --name backend -- start
cd /var/www/dashboard
pm2 start npm --name dashboard -- start
Save and enable autostart:
pm2 save
pm2 startup
β Step 5: Configure NGINX
π Go to /etc/nginx/nginx.conf
http {
# in this block
client_max_body_size 0;# Unlimited or replace 0 to value# Also consider adjusting timeouts for large uploads
client_body_timeout 60s;
client_header_timeout 60s;
keepalive_timeout 60s;
send_timeout 60s;
}
π Go to /etc/nginx/sites-available/
β οΈ Important
π₯ Delete the file named default.
π Do not delete any other file.
Why?
If it stays, your subdomains will not work and you will see the default NGINX page.
π Create 3 files:
root
api
dashboard
Put the following configuration (change subdomain + port):
This guide walks you through deploying a full-stack web application β React/Next.js frontend, Node.js/Express backend, and an admin dashboard β on a fresh Linux VPS, from DNS setup all the way to live HTTPS URLs.
β οΈ If there are existing A records named @, api, or dashboard β delete them first.
Duplicate A records with the same name will break DNS resolution entirely.
3. Add these new A records
Name
Type
Value
@
A
YOUR_VPS_IP
www
A
YOUR_VPS_IP
api
A
YOUR_VPS_IP
dashboard
A
YOUR_VPS_IP
π‘ DNS propagation can take a few minutes up to 48 hours. You can continue setting up the VPS while waiting.
β Step 1 β Connect to VPS via VS Code (Remote SSH)
Using VS Code's Remote SSH extension is the most comfortable way to manage your VPS β you get a full file explorer and integrated terminal.
Open VS Code β Extensions (Ctrl + Shift + X)
Search Remote - SSH β click Install
Press Ctrl + Shift + P, then type and select:
Remote-SSH: Connect to Host...
When prompted, enter your connection string:
ssh root@YOUR_VPS_IP
Press Enter, authenticate with your password or SSH key
You are now inside your VPS π β open the integrated terminal to run commands
β Step 2 β Install Required Software
Run this single block in your VPS terminal to install everything at once:
β This installs: NGINX (reverse proxy), Node.js, PM2 (process manager), Certbot (free SSL), and Git.
β Step 3 β Upload Your Projects
In VS Code's remote file explorer, navigate to /var/www/ and drag your project folders from your local machine directly into it.
Project
Upload To
Frontend (React / Next.js)
/var/www/frontend
Backend (Node.js / Express)
/var/www/backend
Dashboard (React)
/var/www/dashboard
After uploading, install dependencies in each folder:
cd /var/www/frontend && npm install
cd /var/www/backend && npm install
cd /var/www/dashboard && npm install
β οΈ Make sure your .env files are present in each folder with production environment variables set correctly.
β Step 4 β Run Projects with PM2
PM2 is a production-grade process manager. It keeps your apps alive, auto-restarts on crash, and survives server reboots β always prefer PM2 over tmux for production.
cd /var/www/frontend
pm2 start npm --name frontend -- start
cd /var/www/backend
pm2 start npm --name backend -- start
cd /var/www/dashboard
pm2 start npm --name dashboard -- start
# Save the process list & enable autostart on reboot
pm2 save
pm2 startup
β οΈ After running pm2 startup, it will print a command β copy and run that command to register PM2 as a system service.
β Step 5 β Configure NGINX
5a β Global Settings
Open /etc/nginx/nginx.conf and add these lines inside the http { } block:
http{ # Allow large file uploads (replace 0 with e.g. 100m for a specific limit)client_max_body_size 0; # Prevent timeouts on slow connectionsclient_body_timeout60s;client_header_timeout60s;keepalive_timeout65s;send_timeout60s;}
5b β Delete the Default Site
Navigate to /etc/nginx/sites-available/ and delete the default file.
If left in place, NGINX will serve its own placeholder page instead of your apps.