簡體   English   中英

如何確定為什么我的node.js服務器上出現503錯誤?

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

我目前正在以業余愛好者的身份自學node.js。 我有一台服務器,以前可以使用它來處理簡單的“ hello world”輸出。 但是,我認為上周進行一些修補時,我可能已經在node.js服務器中破壞了某些內容,並且不再起作用。 不幸的是,我不確定如何解決問題,並希望為此提供指導。

問題是,當我導航到域時,只會收到503錯誤。

但是,當我檢查node.js日志文件時,輸出將顯示服務器正在運行的默認文本。

我正在使用的示例代碼是:

    // 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");

有人可以幫我找到這個地方,找到我得到503的詳細原因嗎?

我查看了來自Apache的錯誤日志並看到了這一點,但不知道這是什么意思:

[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)

看起來您的node.js配置為偵聽端口8000

server.listen(8000);

但apache嘗試連接到端口8080

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

將兩個應用程序配置為使用相同的端口(並確保尚未使用它)。

我只是有一個類似的問題。 事實證明,我的(生銹)服務器使用的是ip6版本的localhost-:: 1,而不是ipv4版本的127.0.0.1,但是我在Apache proxy命令中使用了后者,因此它們沒有連接。

當我發現netstat的服務器未顯示連接到127.0.0.1時,我就想出了這一點。 一個額外的困惑是因為curl localhost:1234連接正確。 我沒有嘗試過,但是如果我將localhost放入代理行中,它也可能會起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM