Deploy nodejs api to Linode Linux server with nginx
About this lesson
#linode #nodejs #nginx #api #devops #deploy Code - https://github.com/pallishreeb/demo List of commands used in tutorial: ============================ ssh-keygen -t rsa Cat path/to/your/ssh-public-key - it will show your key) Copy paste in linode ssh key sh root@ip Enter the passphrase for public key - apt-get update apt-get install npm npm i -g n n install lts npm install pm2 apt-get install nginx Exit and login again to server. Cd path/to/your/app/end-point(Ex-server.js) Pm2 start server.js -n node-api Pm2 logs Pm2 list Pm2 stop node-api Pm2 start node-api Cd /etc/nginx/sites-available sudo nano default Nginx location block code: ====================== location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } nginx -t systemctl restart nginx Thank you 🙏
DeepCamp AI