How should I organize multiple Express servers on the same system?

前端 未结 2 1485
说谎
说谎 2020-12-07 07:25

I\'m using one server to host multiple Node.js web apps, which are distributed across multiple domains. My current practice is to run an Express server for each app on a dif

2条回答
  •  一整个雨季
    2020-12-07 08:16

    If you don't need to use WebSockets (or any HTTP 1.1 feature, really), you can use NginX as your proxy instead.

    The advantage is the total load NginX can handle versus Node is higher (being statically compiled and specialized for this sort of thing, basically), but you lose the ability to stream any data (sending smaller chunks at a time).

    For a smaller site, or if you're unsure what features you'll need in the future, it's probably better to stick with node-http-proxy and only switch to NginX if you can demonstrate the proxy is the bottleneck on your server. Fortunately NginX isn't hard to set up if you do need it later.

提交回复
热议问题