How To Deploy NextJS With Nginx and PM2

  Рет қаралды 42,179

Full Stack Book

Full Stack Book

Жыл бұрын

Learn how to deploy a Next.js app with PM2, AWS EC2, Ubuntu, DNS Configuration, and Certbot. www.fullstackbook.com/how-to-...
🚀 Full Stack Book Pro Plan. Launch Discount. 75% Off. Valid For The First 100 Redemptions. Expires Apr 30, 2024. Promo Code: LAUNCH75. www.fullstackbook.com/pro

Пікірлер: 62
@oussamafahchouch6871
@oussamafahchouch6871 Жыл бұрын
Thanks for this great NextJS with Nginx tutorial! Including SSL setup :)!
@LachCrafter
@LachCrafter Ай бұрын
thank you so much! It was my dream to have a system like that! Keep it up!
@yash1o1
@yash1o1 Жыл бұрын
Just amazing!!! Helped me a ton. Thank you :)
@excalibur2417
@excalibur2417 Жыл бұрын
This video was oddly satisfying to watch
@transcendmoney
@transcendmoney 2 ай бұрын
thanks, very much. Great tutorial
@fullstackbook
@fullstackbook 2 ай бұрын
Glad it was helpful!
@julioantoniogonzalezmartin3306
@julioantoniogonzalezmartin3306 Жыл бұрын
WOW you are incredible.
@jagjot1697
@jagjot1697 Жыл бұрын
great video!
@bassam.2023
@bassam.2023 Жыл бұрын
Really excellent tutorial! 😀Thanks!
@ianvieira283
@ianvieira283 10 ай бұрын
Can i ask you something? My nextjs app is running just fine, but everyday at 05:00 some "check status" runs in my t2.micro and get "1/2 verified status", and it gets "down", do you know what it would be? :/ everyday at determinated time.... 05:00 or 06:00
@arturfil
@arturfil Жыл бұрын
really good video! I have a question though, is there a potential risk of having the .pem file at the level of the project? Shouldn't we avoid that and if not, obviously we would put that in the .gitignore file but just wondering how to go about this.
@fullstackbook
@fullstackbook Жыл бұрын
You can add it to the .gitignore file to prevent it from getting checked in.
@pedrohenrique3727
@pedrohenrique3727 Жыл бұрын
Você é uma lenda!!!!
@FelipeGenuino
@FelipeGenuino Жыл бұрын
Obrigado, salvou meu dia
@jeff6555
@jeff6555 9 күн бұрын
It's probably very obvious to anyone that has already set up their environment in the past, but the test connection at 10:13 will fail unless you've added your public key to your github account.
@merictunc
@merictunc 2 ай бұрын
like a pro
@manishpaudel6515
@manishpaudel6515 Жыл бұрын
I have server side to my nextjs app with api folder and the frontend is not being able to access the endpoint in pm2 next js; how do I resolve that?
@TheNoblegaz
@TheNoblegaz 3 ай бұрын
Thanks you very much 👌
@fullstackbook
@fullstackbook 2 ай бұрын
You are welcome
@mohamedyoussef8835
@mohamedyoussef8835 Жыл бұрын
Awesome video ++++++++++++++ 🙂
@forrestm.1968
@forrestm.1968 9 ай бұрын
This helped me tremendously! I got my application deployed. Does anyone know how to set up your environment variables in production? I'm using an EC2 instance like the video to host my application.
@fullstackbook
@fullstackbook 8 ай бұрын
There are different ways to do it. You can add them to .bashrc. Or add them to /etc/environment. Or use AWS Parameter Store.
@gonzalogdv
@gonzalogdv Жыл бұрын
Great video! Thank you! Which is the proper way to bring changes in GitHub repository to production?
@fullstackbook
@fullstackbook Жыл бұрын
Run the `pm2 deploy production` command after you push changes to GitHub.
@vivekgautamj
@vivekgautamj Жыл бұрын
Great work there , Just wanted to know how should be handling DB connection on prod server and other config files there ? . Help is really appreciated . Thanks again
@fullstackbook
@fullstackbook Жыл бұрын
Check out my other tutorial kzfaq.info/get/bejne/mJ1jiNqgytW7dqs.html
@the_egyptian_smough
@the_egyptian_smough 10 ай бұрын
Great video, wanted to know how would you add environment variables for this nextjs project and how to configure AWS CodePipeline that works well with this configuration? thank you again :)
@fullstackbook
@fullstackbook 10 ай бұрын
Not sure what the best practice for handling environment vars on an ubuntu server. Maybe put them into .bashrc? Haven't used CodePipeline before. I have some videos on CircleCi, which I believe serves the same purpose.
@ICOReviewtoken
@ICOReviewtoken Жыл бұрын
I only have 1 last step left but I get an error when Permission denied (publickey).
@cubeking.minmin
@cubeking.minmin 10 ай бұрын
Thumbs * 1000. Great Video. Don't remove the video.
@nandanvasista7547
@nandanvasista7547 Жыл бұрын
Thank you so much My Question is After doing some changes locally and committing it to git hub how to make sure that those changes are reflected in the production
@fullstackbook
@fullstackbook Жыл бұрын
You have to run the deployment command. Or set up a CI/CD pipeline to automate the deployment.
@nandanvasista7547
@nandanvasista7547 Жыл бұрын
@@fullstackbook Thanks pal
@user-dy4rh5vz4w
@user-dy4rh5vz4w Жыл бұрын
jenkins you need
@vernevens1598
@vernevens1598 3 ай бұрын
What do I need from Git?
@juanpedro_mario
@juanpedro_mario Жыл бұрын
Thanks for the tutorial Can I do this with yarn instead?
@fullstackbook
@fullstackbook Жыл бұрын
Yes
@lucky_number
@lucky_number Жыл бұрын
@@fullstackbook please help me run with yarn . thank sir
@shawnlee5956
@shawnlee5956 Жыл бұрын
ubuntu 1 GiB Memory able to perform "npm run build" mine 512 Mb RAM ubuntu cant do that, need to manually copy and paste the zip to server. so far next js is good. Thanks for the video. I Learn new things here.
@fullstackbook
@fullstackbook Жыл бұрын
Probably need a larger compute instance.
@lucky_number
@lucky_number Жыл бұрын
it great !!! thank u! please help me create pipeline countinues
@fullstackbook
@fullstackbook Жыл бұрын
check out new pipeline videos
@AdamDrumm
@AdamDrumm Жыл бұрын
Your link in the description is broken good sir.
@fullstackbook
@fullstackbook Жыл бұрын
Thanks
@foxtractnotus928
@foxtractnotus928 11 ай бұрын
how did you solve the github permission denied thingy
@fullstackbook
@fullstackbook 11 ай бұрын
Did you make sure you have forward agent set? kzfaq.info/get/bejne/f92HhKpn0avIgYU.html
@foxtractnotus928
@foxtractnotus928 11 ай бұрын
@@fullstackbook no no i fixed it , it works now ,just that it is not allowing me to open the site becouse of some hydration thingy
@shakibahmed8698
@shakibahmed8698 Жыл бұрын
Hi there your link is not working.
@fullstackbook
@fullstackbook Жыл бұрын
Thanks
@Jonasprodrigues
@Jonasprodrigues Жыл бұрын
I don't understand what is key.pem?
@fullstackbook
@fullstackbook Жыл бұрын
pem file is used as a key to ssh into the server. The “key” part is an arbitrary name I gave it.
@Jonasprodrigues
@Jonasprodrigues Жыл бұрын
@@fullstackbook I understand.. I was confused, I didn't know if it was the public key of git or the server! Thanks 🙏
@moustafakamalalimohammad4041
@moustafakamalalimohammad4041 7 ай бұрын
what key to include it that file?
@foxtractnotus928
@foxtractnotus928 Жыл бұрын
please do with next13
@fullstackbook
@fullstackbook 11 ай бұрын
The steps should be very similar, if not the same.
@foxtractnotus928
@foxtractnotus928 11 ай бұрын
@@fullstackbook allthough nginx is enabled i cant access the simple nginx website ,any advice
@drivebuss8079
@drivebuss8079 Жыл бұрын
such a waste and a grabage.
@emooboyz
@emooboyz Жыл бұрын
For PM2, why do i need to set the key in ecosystem.config?
@fullstackbook
@fullstackbook Жыл бұрын
Maybe you could try setting your public ssh key on the server instead?
@priyankaraut8856
@priyankaraut8856 Жыл бұрын
[PM2][WARN] Applications index, service-worker not running, starting... [PM2][ERROR] Error: Script not found: /home/ubuntu/source/index.js [PM2][ERROR] Error: Script not found: /home/ubuntu/source/service-worker post-deploy hook failed Deploy failed Deploy failed with exit code: 1
@lshcyrus1228
@lshcyrus1228 2 ай бұрын
Hello, thank you for the great tutorial. I am currently facing an error during npm install when running the "pm2 deploy production" command. here is the error: $ pm2 deploy production --> Deploying to production environment --> on host 18.166.xxx.xx ○ deploying origin/main ○ executing pre-deploy-local ○ hook pre-deploy ○ fetching updates ○ full fetch Fetching origin ○ resetting HEAD to origin/main HEAD is now at f9ac097 Delete package-lock.json ○ executing post-deploy `source ~/.nvm/nvm.sh && npm install && npm run build && pm2 reload ecosystem.config.js --env production` [2941:0x5dc0190] 17605 ms: Scavenge 430.4 (452.1) -> 429.3 (451.7) MB, 2.52 / 0.02 ms (average mu = 0.662, current mu = 0.625) allocation failure; [2941:0x5dc0190] 18090 ms: Mark-Compact (reduce) 461.5 (481.1) -> 457.5 (468.1) MB, 168.28 / 0.03 ms (+ 159.1 ms in 44 steps since start of marking, biggest step 19.4 ms, walltime since start of marking 485 ms) (average mu = 0.613, current mu = 0.565) FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0xb84bd6 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [npm install] 2: 0xefeb90 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [npm install] 3: 0xefee77 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [npm install] 4: 0x1110885 [npm install] 5: 0x1128708 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [npm install] 6: 0x10fe821 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm install] 7: 0x10ff9b5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm install] 8: 0x10dc0d6 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [npm install] 9: 0x10cdd04 v8::internal::FactoryBase::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [npm install] 10: 0x10d04e6 v8::internal::FactoryBase::NewRawOneByteString(int, v8::internal::AllocationType) [npm install] 11: 0x1241cb5 v8::internal::JsonParser::MakeString(v8::internal::JsonString const&, v8::internal::Handle) [npm install] 12: 0x1247ccd [npm install] 13: 0x1249c39 v8::internal::JsonParser::ParseJson(v8::internal::Handle) [npm install] 14: 0xf9086e v8::internal::Builtin_JsonParse(int, unsigned long*, v8::internal::Isolate*) [npm install] 15: 0x1971df6 [npm install] bash: line 1: 2941 Aborted (core dumped) npm install post-deploy hook failed Deploy failed Deploy failed with exit code: 1 This error occurred starting from the 2nd time running the command. For the first time, ubuntu stuck during the "creating optimise pages" stage, and the app was never deployed too. Would greatly appreciate any help, thanks.
@fullstackbook
@fullstackbook 2 ай бұрын
Kind of looks like you're running out of memory. You probably need a larger compute instance.
Full Stack NestJS + Next.js Tutorial
32:11
Full Stack Book
Рет қаралды 19 М.
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
How to Host Multiple Node Apps with nginx and pm2
8:20
Code With Bubb
Рет қаралды 10 М.
Deploy your Next.js app to a VPS (EASY!)
15:45
ByteGrad
Рет қаралды 28 М.
BEST ways to deploy a NextJS app
4:56
Rifik
Рет қаралды 34 М.
Deploy Next JS Project via Github and Automate Deployment Nginx VPS
52:27
How I would Learn DevOps from scratch (if I could start over)
15:15
Dockerize Next.js & Deploy to VPS (EASY!)
19:43
ByteGrad
Рет қаралды 43 М.
Нашел еще 70+ нововведений в iOS 18!
11:04
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 126 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,2 МЛН
MacBook Air Японский Прикол!
0:42
Sergey Delaisy
Рет қаралды 540 М.
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 22 МЛН