Node.js一直给出503错误 [英] Node.js consistently giving 503 error
问题描述
我刚刚安装了Node.js,让它工作了一段时间,然后尝试运行标准的Hello World程序。
I just installed Node.js, got it working for a while, then tried to run a standard Hello World program.
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
然后我启动了我为节点设置的域, http://node.foobar.com - 我成功打印 Hello World
当我做了上周在我的域名上也一样。但是现在,我一直收到 503服务暂时不可用错误。
I then launched the domain I set up for node, http://node.foobar.com - I successfully got it to print Hello World
when I did the same on my domain last week. However now, I keep getting 503 Service Temporarily Unavailable error.
这也发生在上周,我关闭了服务器,编辑代码,然后重新启动服务器,它将503,除非我等待几分钟再运行。但是,这次等待没有任何区别。
This happened last week too, after I closed the server, edited the code, then reran the server, it would 503 unless I waited a few minutes before running again. However, waiting makes no difference this time.
域名的Apache配置:
Apache config for domain:
<VirtualHost *:80>
ServerAdmin zadmin@localhost
DocumentRoot "/var/zpanel/hostdata/zadmin/public_html/node"
ServerName node.foobar.com
ProxyRequests on
ProxyPass / http://localhost:3102/
# Custom settings are loaded below this line (if any exist)
</VirtualHost>
推荐答案
如何设置域名?
您是否使用其他HTTP服务器作为代理?
Did you use another HTTP server as a proxy?
请检查节点是否正在运行,如果是,请检查您的HTTP服务器也是。
Please check if node is running, and if yes check your HTTP server is too.
可能你的节点崩溃或者没有运行。
Maybe your node crashed or is just not running.
另一项测试是连接你的节点直接:
Another test is to connect your node directly:
http://127.0.0.1:8081/
这篇关于Node.js一直给出503错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!