简体   繁体   中英

Serving static files in a node.js cluster?

Let's say I have a cluster environment where I basically have the main process (the master) and then I have another 8 worker processes (my cluster). Should the static files be hosted by the main process or should they be hosted on the cluster processes?

If you're using the Node.js built-in Cluster module , the main process should not start an HTTP server, as it will not be able to listen on the same port as the workers. Static files, as with everything else, should be hosted by the workers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM