S
S
sferos2016-10-18 19:06:10
Node.js
sferos, 2016-10-18 19:06:10

Node server not responding on VPS?

there is a VPS server. installed node.js and ran a file with a simple code to test it:
var http = require("http");
var server = new http.Server();
server.listen(9099, "localhost");
server.on('request', function(req, res){
res.end("hello world!");
});
Launched in the console, everything is fine. But when you try to access it through the domain name and port, as well as through the server ip and port, the error "Timed out waiting for a response from the site" and in the console "net:: ERR_CONNECTION_TIMED_OUT"
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-10-18
@sferos

server.listen(9099, "localhost");
your server listens to localhost, specify 0.0.0.0 or server IP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question