Deploy React App on Ubuntu 18.04

Deploy React App on Ubuntu 18.04

React is a JavaScript library that can be used to build user interfaces. React is one of the open source projects of Facebook. This tutorial contains how to install and deploy create-react-app on Ubuntu 18.04.

1.Create User

Create a new user specifically the owner of the React application.

2.Install Node.js

Install Node.js with the version that suits the needs of the React application that was made. Here I am using Node.js 12.x LTS.

Verify the results of installing Node.js.

3.React Application

Create a React application for deploy demo.

Install create-react-app tool.

Creating a project demoreact.

Test running the development server.

The test results run the development server.

Press CTRL + C to stop the development server.

4.Install PM2

PM2 is a production process manager for Node.js. applications.

Install PM2.

Run the React application using PM2.

5.Install Nginx

Next install and setup the Nginx web server. Nginx will run on port 80 (HTTP) accessed by visitors, which will then communicate with PM2 for the execution of the React application.

Create a file server block for the domain with the reverse proxy to PM2. Here I use the developer.web.id for the domain name.

The contents of the developer.web.id.conf file.

Restart Nginx service.

6.Testing Access React App

Browsing the domain name used for the React application.

React Application
React Application

If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!

Donate via PayPal: https://paypal.me/musaamin

2 Comments

Leave a Reply

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