Self-host the Next.js website on an Ubuntu server with Auto Deploy during commits!

HomeOther ContentSelf-host the Next.js website on an Ubuntu server with Auto Deploy during commits!
Self-host the Next.js website on an Ubuntu server with Auto Deploy during commits!
Self-host the Next.js website on an Ubuntu server with Auto Deploy during commits!
To host the Next.js app/website, you only need a server running Node.js. In this video you will learn how to host a next.js website or application on an Ubuntu (Linux) server in the cloud which you can get from Digital Ocean or AWS. Note: In this example, we are not using Vercel, Netlify, or any of the application hosting platforms on Digital Ocean or AWS, as these are also abstractions. We set up an instant, clean Ubuntu (Linux) server from scratch and host Next.js on it. On Digital Ocean you can use droplets. On AWS you can use EC2. Either way, you're setting up a Linux server. The only packages needed on the server are: ngnix, npm, node and pm2

Note: I made a few errors trying to start the website using pm2. They are immediately corrected in the video. I decided to keep the error and correction in the video because I thought it was more helpful if you saw me make the error and correction first, since they are very common.

Introduction: 0:00
Server purchase: 2:43
Server setup: 6:04
SSH to extract: 11:28
Create a Next.js boilerplate: 2:00 p.m.
Clone Next.js on the server: 4:30 p.m.
NGINX configuration file: 18:29
Enable configuration file: 21:33
Launch the application with pm2: 24h00
– error pm2 1:24:48 (make sure to log into the application directory before launching)
– error pm2 2:26:02 (make sure to run the application on the same port that is in the configuration file)
Live on the next.js website: 27:02
Add a domain to the configuration file: 27:34 (also have access to DNS records on your domain name)
Add Free SSL: 30:01
Configure automatic deployment: 31:33
– Add private SSH to GitHub: 35:18
– Add GitHub actions with yml file: 36:21

–ESSENTIAL—

The basics for reference to all commands and configuration files used in the video:
Server setup: https://gist.github.com/oelbaga/5019647715e68815c602ff05cff2416e#file-01-setup-nextjs-site-on-ubuntu-server-terminal-commands

nginx configuration file: https://gist.github.com/oelbaga/5019647715e68815c602ff05cff2416e#file-02-nginx-config-file-for-nextjs-site

yml file for automatic deployment:
https://gist.github.com/oelbaga/5019647715e68815c602ff05cff2416e#file-04-github-actions-for-auto-deployment-deploy-yml

ssh steps for automatic deployment:
https://gist.github.com/oelbaga/5019647715e68815c602ff05cff2416e#file-03-auto-deployment-from-github-to-ubuntu-server

CONNECT ON MY DISCORD COMMUNITY:
https://discord.gg/5zsdrxH8m8

SOCIAL:
Twitter: https://twitter.com/omarel
Website: https://www.omarel.com
LinkedIn: https://www.linkedin.com/in/omarelbaga
GitHub: https://github.com/oelbaga

Please take the opportunity to connect and share this video with your friends and family if you find it useful.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *