开发者

Expressjs to production

I am new to expressjs, I want to deploy an expressjs app to production. Based on my googling, here's the setup on rackspace I am thinking:

1 Load balancer + 2 server + Run app with forever

My questions are:

  1. What engine shall I use to run the app? nginx?

  2. how 开发者_StackOverflow社区many app can I run per server?

Thank you.


  1. If you are serving static files or using any of nginx's reverse proxy features, you can use nginx. But if not, since your servers are behind a load balancer, nginx isn't necessary at all.

  2. The rule of thumb is one node.js/express.js process per core. Have a look at cluster to help you manage this. Make sure your load balancer knows about all the node.js processes you are running (and is not just load balancing between one IP/port pair on each server).

Update: Node.js now has cluster built in out of the box.

Also, if you are deploying on Ubuntu you can use upstart instead of forever if you like.


You need nodejs installed on your machine to run nodejs. nginx is a server used for reverse proxy and a load balancer. Also you can run the app through pm2 instead of forever which will handle all the clustering and running your app in background.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜