我刚刚在远程共享服务器上安装了 node.js 0.8.2(我无法获得更新的版本)。到目前为止,我所能做的就是在运行node file.js
. 但是,我希望能够使服务器正常工作(显然),但它不工作。这是我尝试运行的代码:
//run with node.js
console.log('hello working thingy');
var http=require('http');
var server=http.createServer(function(req,res){
console.log('requested');
res.writeHead(200,{'Content-Type':'text/plain'});
res.end('Hello World!');
});
server.listen(1234,'127.0.0.1');
当我在腻子中运行它时,它说hello working thingy
,但是当我去mydomain.com:1234
浏览器中什么都没有发生并且requested
没有登录到控制台时。我也尝试过替换'127.0.0.1
并mydomain.com
完全排除该论点。我该怎么做才能让它工作?