This guide explains how to deploy the Quick Ecommerce Next.js Admin Panel on a VPS using cPanel (with root or full SSH access). VPS hosting gives you full control and better performance than shared hosting.
Access Your VPS via SSH #
Use an SSH client (PuTTY, Termius, or OpenSSH):
ssh root@your_server_ip
If you don’t have root access, use your cPanel username:
Update the Server & Install Node.js
Update the Server & Install Node.js #
Update system packages #
sudo apt update && sudo apt upgrade -y
Install Node.js (LTS) #
Using NodeSource:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Verify installation:
node -v
npm -v
Install PM2 (Process Manager)
PM2 keeps your Next.js app running even after server reboots.
PM2 keeps your Next.js app running even after server reboots.
Upload Project Files #
- Log in to cPanel → File Manager.
- Go to your subdomain folder (e.g.,
/home/username/admin). - Upload and extract your project ZIP (
Quick-Ecommerce-Api.zip).
Configure Environment File
cp .env.example .env.production
nano .env.production
Update API URL:
NEXT_PUBLIC_REST_API_ENDPOINT=https://api.yourdomain.com/api
Install Dependencies & Build Project #
npm install
npm run build
Start the Application with PM2 #
pm2 start npm --name "Quick-Ecommerce-Api" -- run start
pm2 save
pm2 status
Configure Reverse Proxy (NGINX or Apache) #
If your server uses NGINX:
- Create a new config file:
sudo nano /etc/nginx/sites-available/admin.yourdomain.com
Add this:
server {
listen 80;
server_name admin.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_cache_bypass $http_upgrade;
}
}
Enable and reload NGINX:
sudo ln -s /etc/nginx/sites-available/admin.yourdomain.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
If your server uses Apache (with cPanel), create a proxy rule inside WHM or .htaccess for your subdomain:
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
Install SSL Certificate
If using WHM/cPanel AutoSSL:
- Go to WHM → Manage AutoSSL → Enable AutoSSL for your domain/subdomain.
If using Certbot manually:
sudo snap install --classic certbot
sudo certbot --apache -d admin.yourdomain.com
sudo certbot renew --dry-run
Verify Installation #
Visit your subdomain:
https://admin.yourdomain.com