=============================================================================================
=============================================================================================
SSH into the server
ssh root@ipaddress
Create project directory
cd /home/
mkdir projectName
cd projectName
Clone the repository from github
git clone linkToTheRepo
Test if the node version on the server is compatible with the version being used by your code
npm install
npm start
Build the react app files
npm run build
Create a folder to store the static files
mkdir /var/www/myProject
Copy the build file to a
sudo cp -R build/ /var/www/myProject/
=============================================================================================
=============================================================================================
Navigate to the sites-enabled folder
cd /etc/nginx/sites-enabled
Create a file where you will store your apps configs
sudo touch myAppName
Open the file
sudo nano myAppName
Copy these configs
server {
listen 80;
server_name MY_IP_ADDRESS;
location / {
root /var/www/myProject/build;
index index.html;
try_files $uri $uri/ /index.html?$args;
}
}
ctrl x and save the file
Sync the build file with the static files in /var/www/
sudo rsync -a build/ /var/www/myProject/build/
Restart nginx
sudo service nginx restart