Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-29 11h : 7 posts(29.09.2026 um 11:00 Uhr)
•
IT Security NachrichtenSeptember 2026 Cyber Attacks Timeline(29.09.2026 um 11:01 Uhr)
•••
IT Security NachrichtenCloudflare’s EmDash 1.0 makes sandboxed plugins ask for access first(29.09.2026 um 11:03 Uhr)
•
IT Security NachrichtenEngineering velocity is a competitive advantage in modern cybersecurity(29.09.2026 um 11:00 Uhr)
•
Sicherheitslücken (CVE)Kiteworks patches critical flaw, brings customer systems online(29.09.2026 um 11:04 Uhr)
•
IT Security NachrichtenGroßrazzia gegen Mogel-Handy-Ring: 300 Millionen Euro Schaden(29.09.2026 um 11:14 Uhr)
•
Malware / Trojaner / VirenMalware-Schutz auf QNAP-NAS richtig steuern(29.09.2026 um 11:00 Uhr)
••
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-29 11h : 7 posts(29.09.2026 um 11:00 Uhr)
•
IT Security NachrichtenSeptember 2026 Cyber Attacks Timeline(29.09.2026 um 11:01 Uhr)
•••
IT Security NachrichtenCloudflare’s EmDash 1.0 makes sandboxed plugins ask for access first(29.09.2026 um 11:03 Uhr)
•
IT Security NachrichtenEngineering velocity is a competitive advantage in modern cybersecurity(29.09.2026 um 11:00 Uhr)
•
Sicherheitslücken (CVE)Kiteworks patches critical flaw, brings customer systems online(29.09.2026 um 11:04 Uhr)
•
IT Security NachrichtenGroßrazzia gegen Mogel-Handy-Ring: 300 Millionen Euro Schaden(29.09.2026 um 11:14 Uhr)
•
Malware / Trojaner / VirenMalware-Schutz auf QNAP-NAS richtig steuern(29.09.2026 um 11:00 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Complete Guide: Deploying Node.js Application on Ubuntu VPS

A step-by-step guide to deploy your Node.js application with MongoDB, Nginx reverse proxy, and SSL certificate on a DigitalOcean Droplet or any Ubuntu VPS. Prerequisites A DigitalOcean Droplet (or any Ubuntu VPS) A domain name…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

A step-by-step guide to deploy your Node.js application with MongoDB, Nginx reverse proxy, and SSL certificate on a DigitalOcean Droplet or any Ubuntu VPS.






Prerequisites




  • A DigitalOcean Droplet (or any Ubuntu VPS)

  • A domain name (optional, but required for SSL)

  • SSH access to your server

  • Your Node.js application hosted on GitHub









Step 1: Connect to Your Server



SSH into your droplet using the root user:




ssh root@YOUR_DROPLET_IP






Replace YOUR_DROPLET_IP with your actual server IP address.









Step 2: Update System Packages



Always start by updating and upgrading your system packages:




sudo apt update && sudo apt upgrade -y












Step 3: Install Required Packages



Install Node.js, npm, and Nginx:




sudo apt install -y nodejs npm nginx












Step 4: Install Node Version Manager (NVM)



NVM allows you to manage multiple Node.js versions easily.






Download and install NVM:






curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash









Load NVM into current session:






source ~/.bashrc









Install and configure Node.js 20.10.0:






nvm install 20.10.0
nvm use 20.10.0
nvm alias default 20.10.0









Verify installation:






node --version
npm --version












Step 5: Install MongoDB



MongoDB is a popular NoSQL database for Node.js applications.






Import the public key:






curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor









Create the list file for Ubuntu 22.04:






echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list









Update packages and install MongoDB:






sudo apt update
sudo apt install -y mongodb-org









Start and enable MongoDB:






sudo systemctl start mongod
sudo systemctl enable mongod
sudo systemctl status mongod






For complete MongoDB installation instructions, refer to the official documentation.









Step 6: Setup SSH Key for GitHub



Generate an SSH key to clone your private repositories:




ssh-keygen -t rsa -b 4096 -C "[email protected]"






Press Enter to accept default file location and optionally set a passphrase.






Display your public key:






cat ~/.ssh/id_rsa.pub









Add the key to GitHub:




  1. Copy the entire output

  2. Go to GitHub → Settings → SSH and GPG keys

  3. Click "New SSH key"

  4. Paste your key and save









Step 7: Clone Your Repository



Navigate to your preferred directory and clone your repository:




cd /var/www
git clone [email protected]:username/repository.git
cd repository









Install dependencies:






npm install












Step 8: Configure Nginx as Reverse Proxy



Nginx will handle incoming HTTP requests and forward them to your Node.js application.






Create a new Nginx configuration file:






sudo nano /etc/nginx/sites-available/your-app-name









Add the following configuration:






server {
listen 80;
server_name YOUR_DOMAIN_OR_IP;

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;
}
}






Replace YOUR_DOMAIN_OR_IP with your domain name or server IP address.






Enable the configuration:






sudo ln -s /etc/nginx/sites-available/your-app-name /etc/nginx/sites-enabled/









Test Nginx configuration:






sudo nginx -t









Reload Nginx:






sudo systemctl reload nginx












Step 9: Managing Your App with Tmux



Tmux keeps your application running even after you disconnect from SSH.






Tmux Commands Reference:




































Command Description
tmux new -s session_name Create a new session
tmux attach -t session_name Attach to existing session
tmux ls List all sessions
tmux kill-session -t session_name Kill a session
tmux rename-session -t old_name new_name Rename a session

Ctrl+B then D
Detach from current session





Start your application:






tmux new -s myapp
cd /var/www/repository
npm start






Press Ctrl+B then D to detach and leave it running.









Step 10: Configure Firewall (UFW)



Enable and configure the firewall:




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












Step 11: Install SSL Certificate (HTTPS)



Secure your application with a free SSL certificate from Let's Encrypt.






Install Certbot:






sudo apt install certbot python3-certbot-nginx









Obtain SSL certificate:






sudo certbot --nginx -d example.com -d www.example.com






Replace example.com with your actual domain name.



Certbot will automatically configure Nginx for HTTPS and set up auto-renewal.






Test auto-renewal:






sudo certbot renew --dry-run












Quick Reference Commands






Server Management:






# Restart Nginx
sudo systemctl restart nginx

# Check Nginx status
sudo systemctl status nginx

# View Nginx error logs
sudo tail -f /var/log/nginx/error.log

# Restart MongoDB
sudo systemctl restart mongod

# Check MongoDB status
sudo systemctl status mongod









Application Management:






# Pull latest changes
cd /var/www/repository
git pull origin main

# Install new dependencies
npm install

# Restart application (inside tmux session)
tmux attach -t myapp
# Press Ctrl+C to stop, then npm start











PM2 is a production process manager for Node.js applications.






Install PM2:






npm install -g pm2









Start your application:






pm2 start app.js --name "your-app-name"









PM2 Commands:






pm2 list              # List all processes
pm2 restart app-name # Restart application
pm2 stop app-name # Stop application
pm2 logs # View logs
pm2 startup # Configure PM2 to start on boot
pm2 save # Save current process list












Troubleshooting






Application not accessible:




  1. Check if the app is running: tmux attach -t myapp

  2. Verify Nginx config: sudo nginx -t

  3. Check firewall: sudo ufw status

  4. Review Nginx logs: sudo tail -f /var/log/nginx/error.log






MongoDB connection issues:




  1. Check if MongoDB is running: sudo systemctl status mongod

  2. Review MongoDB logs: sudo tail -f /var/log/mongodb/mongod.log






SSL certificate issues:




  1. Ensure domain DNS points to your server IP

  2. Check Certbot logs: sudo certbot certificates

  3. Renew manually: sudo certbot renew









Conclusion



Your Node.js application is now deployed with:




  • ✅ Latest Node.js version via NVM

  • ✅ MongoDB database

  • ✅ Nginx reverse proxy

  • ✅ SSL/HTTPS encryption

  • ✅ Firewall protection

  • ✅ Process management with Tmux or PM2



For production applications, consider implementing additional security measures, setting up automated backups, and configuring monitoring tools.






Last updated: January 2026

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Complete Guide: Deploying Node.js Application on Ubuntu VPS

Thematisch verwandte Begriffe: Complete, Guide, Deploying, Nodejs · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102240 | A vulnerability was found in Netcore NAP930 0.1.241010.141410. This aff…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag