Linux serverlinux web serverNETWORK ADMINISTRATIONS

Deploy React and NodeJS on Linux

Get the DevOps Roadmap for 2022 here: https://devopsfordevelopers.io/roadmap

In this video you will learn how to setup a Linux server to host your React + NodeJS application from scratch. This video uses Ubuntu with NVM for providing the NodeJS runtime, PM2 to kee our applications running, and Nginx as a reverse proxy to provide scalability and SSL termination.

I also share with you why I *rarely* use this configuration for my own apps, and what I do instead.

——————————🎥 C H A P T E R S ——————————

0:00 Introduction
1:52 Application overview
2:42 SSH into our Linux server
3:58 Create a user account for nodejs
6:10 Git the code for our applications
6:55 Install NodeJS
8:30 Install application dependencies
9:49 Use PM2 to keep our apps running
13:40 Start PM2 at boot time
15:20 Installing nginx
18:39 Verify our setup
22:30 Troubleshooting connectivity issues
24:30 Setting up SSL on nginx
25:50 When to use this setup
28:30 Other ways to deploy

——————————👋 C O N N E C T ——————————
Discord ▻ https://devopsfordevelopers.io/discord
Twitter ▻ https://twitter.com/wfbutton

——————————🛠 R E S O U R C E S ——————————
The DevOps Career Guide ▻ https://devopsfordevelopers.io/devops-career-guide
DevOps Roadmap ▻ https://devopsfordevelopers.io/roadmap
DevOps merch ▻ https://devopsfordevelopers.io/merch

source

by DevOps For Developers

linux web server

20 thoughts on “Deploy React and NodeJS on Linux

  • The DevOps Roadmap for 2022 is available for free at https://devopsfordevelopers.io/roadmap
    One of the hardest things about learning is understanding how the different components work together. Using this guide, you start with a topic that interests or relates to you. At the end of the section, other related topics are shown allowing you to pick and choose your own path to DevOps mastery.
    Check it out and leverage the skills you learn to advance your career as a developer, sysadmin, IT Operations, QA and more!

  • Does the front end react application is running on port 8080? Whether it must be the same when we run pm2 serve build 8080 –spa ?

  • can i use npm run bild in my vs code terminal and later push it into github ropo then pull to this production terminal …because it is taking too long in ubuntu

  • usually how long does it takes to complete npm run build?

  • Oh my god! This video is amazing. Thank you so much! My problems are gone

  • Awesome stuff. I loved the last two chapters. it is good to let ppl that are new to this type of thing know that it can be optimized.
    Github actions is also a good option.

  • What pm2 command do I run for a plain node ts app when I built one from scratch?

  • I need to know what the api start script should be for people like me who built something from scratch. I can't get mine working. Keep getting errors.

  • where are the videos for this deployment in diffrent ways..

  • Hey Will! Thanks for the awesome tutorial! Can you please share what DNS Server app you used in your video (timestamp at 22:00) for setting up the custom domain name?

  • HI May You know why it doesn't work in my case?
    server {
    listen 80;
    listen [::]:80;

    root /var/www/xxx.xxx.xxx.xx; <IP

    location /portfolio {
    try_files /portfolio$uri /portfolio$uri/ =404;
    }
    location /portfolio2 {
    try_files /portfolio2$uri /portfolio2$uri/ =404;
    }
    }

    under the path > /var/www/xxx.xxx.xxx.xx i have 2 folders portfolio and portfolio2 which have build react code inside of each path
    Thx a lot for response

  • Any Idea how to deploy after build a few react/node apps on the same ubuntu server? probably using nginx? it could be server on different url IP/APP1 IP/app2

  • Very nice video Will! I learned quite a bit.

Comments are closed.