Can I host node.js and Django on the same server?

I have only one VPS hosting and using nginx for a Django web application. Now I am ready to start a new application with Node.js and can I host it on the current server? I think Node.js is starting its own HTTP server and could conflict with the nginx server.

+4
source share
2 answers

You can host multiple http servers on one VPS. The conflict will occur only if both nginx and node.js are connected to the same port. For example, if your nginx web server is listening on port 80, then your node.js http server should not listen on 80, but say port 8080. You can also configure a reverse proxy server (in case you need to abstract the internal network and serve clients on the same port), where you will accept incoming connections on port 80, and nginx will send a node.js-specific message to port 8080.

+2
source

If you have multiple IP addresses, you can connect nginx to IP1 port 80 and hosts on IP 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 .

+1
source

All Articles