sudo apt update
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install bootstrap
sudo npm add axios
sudo npm install react-router-dom
cd ~
git clone https://github.com/assyafii/product-apps.git
cd product-apps
cd product-apps
npm install
npm run build
npm start
sudo nano /lib/systemd/system/product.service
Add code bellow :
[Unit]
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/home/ubuntu/product-apps
ExecStart=/usr/bin/npm start
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start product
sudo systemctl enable product
sudo systemctl status product
sudo apt update
sudo apt-get install nginx
sudo nano /etc/nginx/sites-available/product-apps.conf
server {
listen 80;
location / {
proxy_pass http://localhost:3000;
}
}
sudo unlink /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/product-apps.conf /etc/nginx/sites-enabled/product-apps.conf
sudo systemctl restart nginx
sudo systemctl status nginx
Semangat yaa :)