Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine why I'm getting 503 errors on my node.js server?

I am currently teaching myself node.js as a hobbyist. I have a server that I was previously able to get to work with simple 'hello world' outputs. However, I think I might have broken something in my node.js server while doing some tinkering last week and it no longer works. Unfortunately, I am not sure how to troubleshoot the answer and am hoping for direction on that.

The issue is that when I navigate to my domain I just get a 503 error.

However, when I check my node.js log file, the output is displaying my default text that the server is running.

The sample code I'm using is:

    // Load the http module to create an http server.
var http = require('http'),
    sys = require('sys');

// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello World\n");
});

// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(8000);

// Put a friendly message in the log
sys.puts("Server running on port 8000");

Can anyone help me discover the place to find more detailed reasons on why I'm getting a 503?

I looked at the error logs from apache and see this, but have no clue what it means:

[Fri May 30 18:12:09.658627 2014] [proxy:error] [pid 25351:tid 3071591036672] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed
[Fri May 30 18:12:09.658713 2014] [proxy:error] [pid 25351:tid 3071591036672] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Fri May 30 18:12:09.658731 2014] [proxy_http:error] [pid 25351:tid 3071591036672] [client 128.32.70.98:19556] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
[Fri May 30 18:12:10.096354 2014] [proxy:error] [pid 25351:tid 3071599429376] AH00940: HTTP: disabled connection for (127.0.0.1)
like image 924
RoccoMaxamas Avatar asked Feb 03 '26 04:02

RoccoMaxamas


1 Answers

Looks like your node.js is configured to listen on port 8000

server.listen(8000);

but apache is trying to connect to port 8080

HTTP: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed
                                        ^

Configure both application to use the same port (and make sure it is not already in use).

like image 162
Gerald Schneider Avatar answered Feb 04 '26 18:02

Gerald Schneider



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!