I am deploying a nodejs app I have tried two alternatives but I can't understand what's the better approach in terms of performance.
The first approach I tried is to lunch using pm2 npm start
(which in my case call npx http-server ./ -p 8085 -o -c-1
).
Then using Nginx I proxy_pass
the port 8085
to myexample.org/app
.
The second approach is to simply put the application in my root directory so that Nginx can directly serve myexample.org/app
.
I can't understand the advantages and the disadvantages of the two approaches in both the apps seem working fine. Can you give me some reason I should opt for one approach instead of the other? Is there a better approach?