To deploy a React app using PM2 on Ubuntu Server 24.04, follow the steps below.
Step 1 : Install PM2 globally using npm:
Step 2 : To ensure PM2 starts on system boot, run:
Step 3 : Create a new React app using create-react-app:
Step 4 : Navigate to the root of your React app and build it:
Step 5 : Run the built React app with PM2:
Step 6 : Open your browser and navigate to your server's IP address or domain name followed by port 3000 (e.g., http://your_server_ip:3000) to test the React app.
Step 7 : You can manage your React app deployed with PM2 using various commands:
- Check status:
- Restart:
- Reload:
- Stop:
- Delete:
Congratulations! You have successfully deployed a React app using PM2 on Ubuntu Server 24.04.