I created a small hello world node app, then i hosted the app on digital ocean droplet, after that i can access my application on http://my_public_ip:3000
Felt happy π
Then i bought a domain name called helloworld.tk free domain from freenom.com After that i install nginx as a webserver in my droplet then i added a reverse proxy code in /etc/nginx/sites-enable/default
My code looks like:
server {
listen 80;
server_name helloworld.tk
location / {
proxy_pass http://localhost:3000;
}
}
After that i went to domain management panel in my freenom.com and set url forwarding to http://my_public_ip
So if i enter my domain name helloworld.tk in browser my node app successfully works π€© but wait what π€ my ip address is showing on left side below corner on chrome and if i refresh the page multiple times i get
402 Too many request error page on nginx
So i deleted my url forwarding and in my domain management panel instead of url forwarding i set my nameservers like this ns1.digitalocean.com bla.bla.bla...
Then i added my domain in my digitalocean panel. Now yes everything is working perfect.
If i hit my url no ip address is showing, also no too many request errors π
My node app successfully getting executed!
Wait i am a beginner for hosting node app, so i need help whether it is correct good setup for nodeapp on production?
What is the difference between url forwarding and nameservers? Whether my nginx reverse proxy code is correct? is my reverse proxy working correctly?
NOTE: I used pm2 for running node app on background.