👉 GitHub password allow করে না .
✅ Solution → SSH Key (BEST & STANDARD)
HTTPS use করা = beginner mistake 😄
Production server always uses SSH.
✅ STEP 1 — Generate SSH Key (Server)
Server এ run করো:
ssh-keygen -t ed25519 -C "server"
Press Enter → Enter → Enter
(no password)
তারপর:
cat ~/.ssh/id_ed25519.pub
Output copy করো.
✅ STEP 2 — Add SSH Key to GitHub
Go to:
👉 GitHub → Settings
👉 SSH and GPG Keys
👉 New SSH Key
Paste key.
Save.
✅ STEP 3 — Clone Again (IMPORTANT)
Now use SSH:
git clone git@github.com:url.git
👉 DONE ✅
আর username/password চাইবে না.
🔥 STEP 4 — Install Node (If not installed)
Check:
node -v
If missing:
👉 Install Node 20 (recommended)
VERY IMPORTANT:
Use NVM (never install Node globally on production)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
reload:
source ~/.bashrc
Install node:
nvm install 20
nvm use 20
🔥 STEP 5 — Install PM2 (Production Manager)
PM2 keeps the app alive.
Install:
npm install -g pm2
Check:
pm2 -v
🔥 STEP 6 — First Build (Manual One Time)
Go project:
cd landing-page-katsana
Install:
npm install
Build:
npm run build
Start:
pm2 start npm --name "demo" -- start
Check:
pm2 list
If running → perfect ✅
Auto start after reboot:
pm2 startup
pm2 save
VERY IMPORTANT — don’t skip.
🔥 STEP 7 — Setup NGINX (Reverse Proxy)
Why?
👉 Port 3000 expose করা is dangerous
👉 Nginx handles domain + SSL + speed.
Install:
yum install nginx -y
Start:
systemctl start nginx
systemctl enable nginx
✅ Create Config
nano /etc/nginx/conf.d/fileName.conf
Paste:
server {
listen 80;
server_name example.com.bd www.example.com.bd;
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;
}
}
Save.
Test:
nginx -t
Reload:
systemctl reload nginx
👉 Now site LIVE 🎉
🔥 MOST IMPORTANT PART (AUTO DEPLOY)
Now আমরা automation করবো.
⭐ Best Method → GitHub Action + SSH Deploy
No FTP needed.
Real DevOps style.
✅ STEP 8 — Create GitHub Secrets
GitHub repo → Settings → Secrets → Actions
Create:
HOST = server ip
USERNAME = root
SSH_KEY = your private key
To get the private key:
On your PC:
cat ~/.ssh/id_ed25519
Copy the full key.
✅ STEP 9 — GitHub Action (AUTO DEPLOY)
Create:
.github/workflows/deploy.yml
Paste:
name: Deploy to Dedicated Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /home/katsan/landing-page/landing-page
git pull origin main
npm install
npm run build
pm2 restart katsan
🔥 RESULT (Now Your Flow)
You push code:
git push origin main
👇
GitHub Action runs
👇
SSH into the server
👇
git pull
👇
build
👇
PM2 restart
🔥 ZERO manual work.
⭐ PRO TIP (Senior Secret)
Use this instead of npm install:
npm ci
👉 faster
👉 cleaner
👉 production safe
🚨 VERY IMPORTANT SECURITY WARNING
👉 NEVER use root for deployment long term.
Later create user:
deploy
Give sudo.
More secure.
🔥 Architecture You Just Built
This is used by:
👉 SaaS companies
👉 production startups
👉 high traffic apps
You are no longer a beginner after this 😄
If you want — next level setup আমি তোমাকে দিতে পারি:
🔥 ZERO downtime deploy
🔥 Blue-green deployment
🔥 Docker setup
🔥 CI/CD pro pipeline
🔥 Auto SSL
🔥 Server hardening
🔥 Fail2ban
🔥 Redis cache
🔥 5x Next.js speed
Top comments (0)