Answer the question
In order to leave comments, you need to log in
How to run nodeJS with different IP on the same server?
There is a server (for example VPS) which has several IP addresses. You need to run 2 nodejs scripts with different IPs, and you can’t specify this separately in some module, you need to somehow externally. Maybe in some kind of sandbox, or something else?
Answer the question
In order to leave comments, you need to log in
If the server has multiple IPs, then make listen on 0.0.0.0 or don't specify the second listen parameter at all: server.listen(80)
https://nodejs.org/api/http.html#http_server_liste...
HttpServer.listen(80, 8.8.8.8);
HttpServer.listen(80, 9.9.9.9);
1) try to change the IP as in the first tip
2) try to change the port and use an external balancer
3) run in a virtual environment (for example, docker)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question