I'm having a demo this coming week and I need to deploy the application I'm working on (developed using MEANjs stack) preferably to a server like nginx or the like.
I'm behind a Red-hat box so my question is what would be the best practices when deploying an application to production
- Does a deploy to nginx is viable? (redhat box has already installed apache, do I need to interchange with nginx?)
- is there any notes on what to and not to do for this process?
I've found this How to deploy MEAN.js (Node.js) application to Production environment
and I was trying to comment but don't have the required points :D so anyway, don't quite understand the nginx part(putting in front) so that means that you don't actually deploy the app into nginx ?
I've also look at other questions like:
so its like do we really need ningx, apache or the like from the best practices perspective?, or the way to go is just rsync the content to a production server folder and start your app with Upstart?
what about using Passenger with MEANjs anyone used this?
EDIT:
Alright so I have my meanjs server running on port 8002 below is my configuration for ningx, which is working as far as I can tell allright, now what about securing this setup?
EDIT2:
Well I'm learning here so this is what I found https://groups.google.com/forum/#!topic/meanjs/_Kb07-tvlzU
apparently in order to deploy this after running the "grunt build" command just
run it like so :
node server.js
and apparently it will get all your configuration from production.js
Not completely sure if it would be production ready.
and now I think I should move this to somewhere like /var/www/theAppFolder/ for organizational sake.
this is nginx configuration
upstream proj{
server 127.0.0.1:8002;
}
server{
listen 0.0.0.0:80;
server_name dep01.local poc;
access_log /var/log/nginx/dep01.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://proj/;
proxy_redirect off;
}
}