Deploy MERN App with Hostinger VPS in 10 Steps || Ubuntu || Git Actions

preview_player
Показать описание

1. Connecting to Your VPS Using SSH - Starting with establishing a secure connection to your VPS, ensuring a safe and exclusive access environment for your deployment.

2. Updating the VPS - Keeping your server up to date with the latest packages and security patches to ensure optimal performance and security.
sudo apt-get update and sudo apt-get upgrade

3. INSTALL NODE.JS:
source ~/.bashrc

4. INSTALL MONGODB
sudo apt update
sudo apt install mongodb-org -y
sudo systemctl start mongod
sudo systemctl enable mongod

Install git:
sudo apt-get install git-all

5. INSTALL PM2

6. INSTALL NGINX
sudo apt install nginx -y

7. Configure NGINX as a reverse proxy for your application. Create and edit a new configuration file:

server {
    listen 80;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

8. Enable the configuration by creating a symlink and then test and reload NGINX:
sudo nginx -t
sudo systemctl reload nginx

9. Secure Your Application with SSL (HTTPS)
Install Certbot and the NGINX plugin:

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

10. Open Necessary Ports in the Firewall
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable

sudo ufw status

#MERNStack #WebDevelopment #FullStackDeveloper #CodingTutorial #HostingerVPS #UbuntuServer #NodeJS #ReactJS #MongoDB #NginxProxy #DevOps #WebHosting #SSLSetup #JavaScript #PM2 #CodingLife #TechTutorial #ProgrammerLife #WebAppDeployment #SecureHosting
Рекомендации по теме
Комментарии
Автор

omg bro, you were so helpful for me. thanks for making this video.

AteneaConocimientos
Автор

If you had any changes to the repo on your local repo and push it to github. How do you update inside the vps hosting?

enakgaming
Автор

I can’t stop thanking you homie but I have one more question the project that I’m working on has an admin folder Running on a different port number so how can I do that as well please

bilbyplaisir
Автор

what is url for my api I did all steps according to you but not know which is the basic url for my api

qalbichamp
Автор

bro Thanks alot I found this video super helpfully, I have bug after command : sudo systemctl reload nginx : Error : nginx.service is not active, cannot reload., do you have any idea of what goes wrong on my issue . thanks bro

ajmalleonard
Автор

How to deploy branch for example staging branch. i believe this tutorial deploy for the main branch. Please make a video for it

saharilarshad
Автор

Thanks for the video it helped me a lot but I do have a few questions the first one is : do I have the purchase the premium shared hosting as well with the vps to host the mern app ? And the last one is: do I need a mongodb production plan to deploy to production? Thank you again

bilbyplaisir
Автор

Bro u are a life saver. I have been trying to deploy my app in hostinger, watched so many videos and I get some ideas from there but this one you really did a good job here, this one is a great video on hosting. And I am expecting some help if I ended up in some errors.

btw I am using firebase as my db, is there anything I have to do or change when deploying rather than giving the env correctly during the deployment.

akshaykumar-xube
Автор

thanks for sharing this useful video, can we host 2 websites on the same server?

btw: you remind me of bob marley

alexdin