Self-Host Next.js & PostgreSQL On VPS - Full Tutorial (Custom Domain, SSL, Security)
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: …
Watch on YouTube ↗
(saves to browser)
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
DeepCamp AI