Can I host node.js and Django in one server?
I only have one VPS hosting and using nginx for Django web application. Now, I prepare to start new app with Node.js and can I host on current Server ? I think, Node.js is running the own http server and it can conflict with ng开发者_StackOverflowinx server.
You can host multiple http servers on single VPS. Conflict will happen only if both, nginx and node.js, are bound to the same port. For example if your nginx web server is listening on port 80, then your node.js http server should listen on other than 80, lets say port 8080. You can also set up reverse proxy (in case you need to abstract your internal network and serve clients on the same port) where you will accept incoming connections on port 80 and nginx will forward communication specific for node.js to port 8080.
If you have multiple IP addresses you can have nginx listen to IP1 port 80 and nodejs on IP2 port 80, if this is not the case (you only have one IP address) you may need to use different ports for each web server.
精彩评论