Self-Host Next.js & PostgreSQL On VPS - Full Tutorial (Custom Domain, SSL, Security)

Coding in Flow · Beginner ·📊 Data Analytics & Business Intelligence ·1y ago
Learn how to self-host your Next.js app and a local Postgres database on a cheap VPS. Set up Nginx and PM2 and secure your server with a Firewall. Connect a real domain and set up a free SSL certificate. Every step and command is provided. Get a cheap VPS on Hostinger (Use code CODINGINFLOW for 10% off): http://hostinger.com/codinginflow All steps & commands for copy-pasting: https://gist.github.com/codinginflow/80400c19e73d94f6326c578a9f19c803 The sample project we will deploy: https://github.com/codinginflow/next-self-hosting ⭐ Get my full-stack Next.js with Express & TypeScript course: https://codinginflow.com/nextjs ✅ Get my free React Best Practices course: https://www.codinginflow.com/reactbestpractices 💌 Join my newsletter for regular web dev tips: https://codinginflow.com/newsletter 💬 Join our developer community on Discord: https://codinginflow.com/discord 📣 Follow Coding in Flow on social media: Twitter: https://twitter.com/codinginflow Instagram: https://instagram.com/codinginflow TikTok: https://tiktok.com/@codinginflow Facebook: https://facebook.com/codinginflow Timestamps: 0:00 - Overview 0:51 - Self-hosting vs Vercel 2:50 - Sample project overview 7:57 - VPS server setup 10:50 - VPS configuration + security (sudo, ssh keys, ufw, pings) 25:34 - Node.js, Git, PostgreSQL installation + setup 35:43 - Nginx installation + configuration 41:44 - PM2 installation + setup (logs, startup script) 46:57 - Custom domain + SSL (Certbot) setup
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related AI Lessons

Chapters (9)

Overview
0:51 Self-hosting vs Vercel
2:50 Sample project overview
7:57 VPS server setup
10:50 VPS configuration + security (sudo, ssh keys, ufw, pings)
25:34 Node.js, Git, PostgreSQL installation + setup
35:43 Nginx installation + configuration
41:44 PM2 installation + setup (logs, startup script)
46:57 Custom domain + SSL (Certbot) setup
Up next
Introduction to 3-Statement Modeling
Coursera
Watch →