I\'ve set up Node.js and Nginx on my server. Now I want to use it, but, before I start there are 2 questions:
You can run nodejs using pm2 if you want to manage each microservice means and run it. Node will be running in a port right just configure that port in nginx(/etc/nginx/sites-enabled/domain.com)
server{
listen 80;
server_name domain.com www.domain.com;
location / {
return 403;
}
location /url {
proxy_pass http://localhost:51967/info;
}
}
Check whether localhost is running or not by using ping.
And
Create one single Node.js server which handles all Node.js requests. This reads the requested files and evals their contents. So the files are interpreted on each request, but the server logic is much simpler.
This is best and as you said easier too