为什么我不能在共享服务器上使用 node.js?
why can't i use node.js on shared server?
我敢肯定,在专家看来,我听起来像个菜鸟……node.js 很陌生。我刚刚学到的一件事是我可以用这样的东西启动一个基本的服务器..
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
现在我可以使用
在 cli 上访问
$ node the-above-code.js
为什么不能在共享服务器上实现相同的效果,例如去吧爸爸?这里面有什么概念上的问题?
问题是 godaddy 不允许您更改 apache 设置以让您绑定到端口 8888。您必须让自己拥有一个私人服务器才能做到这一点。
参考这个话题:
Why node.js can't run on shared hosting?
我敢肯定,在专家看来,我听起来像个菜鸟……node.js 很陌生。我刚刚学到的一件事是我可以用这样的东西启动一个基本的服务器..
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
现在我可以使用
在 cli 上访问$ node the-above-code.js
为什么不能在共享服务器上实现相同的效果,例如去吧爸爸?这里面有什么概念上的问题?
问题是 godaddy 不允许您更改 apache 设置以让您绑定到端口 8888。您必须让自己拥有一个私人服务器才能做到这一点。
参考这个话题: Why node.js can't run on shared hosting?