INSTALL SSL on Node JS Application
1st chek on which port you are running your node js you can chek by typing Useful Command for Node
• pm2 log (shows log)
• pm2 list (show all running app)
• pm2 stop all (stop all application)
• pm2 flush (flush all from cache)
• pm2 kill (kill all process)
• pm2 strat 0 or 1 (for starting project pm)
• pm2 update (update aap some time need for app running)
• pm2 stop 0 (aap name)
• pm2 restart 0 (aap name )
Or you can edit and see port in index file
After that check your Nginx service running properly
• systemctl status nginx
Create nginx config
• sudo touch /etc/nginx/conf.d/yoursite.com.conf
• sudo nano /etc/nginx/conf.d/yoursite.com.conf
• sudo systemctl start nginx
• sudo systemctl enable nginx
Sometimes do not need to install the Nginx service it's a built-in node application there for just create the above file in the path if you install Nginx it will conflict port.
NOW paste the code in yoursite.com.conf file and change as per your requirement
server {
server_name yoursite.com;
location / {
proxy_pass http://localhost:8080;
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;
}
}
For installation certificate must node application 1st
Install Certbot
• yum –y install epel-release
• yum –y install yum-utils
• yum –y install certbot-nginx if you have apace install certbot-apache
• sudo yum install python3-certbot-nginx
• sudo certbot --nginx
• now select a type to complete your registration
No comments:
Post a Comment