node.js on hosted account (non localhost) good install server started but (not found)

I installed node.js on a hosted Apache server. The simple server I placed on the server runs fine, but when I go to the website I cannot see the website.

I initially tested this on my local machine and it works fine, but I need this on a production website. How can I do this.

My Node.js code

[code]
// Load the net module to create a tcp server.
var net = require('net');

// Setup a tcp server
var server = net.createServer(function (socket) {

  // Every time someone connects, tell them hello and then close the connection.
  socket.addListener("connect", function () {
    sys.puts("Connection from " + socket.remoteAddress);
    socket.end("Hello World\n");
  });

});

// Fire up the server bound to port 7000 on localhost
server.listen(1337, "localhost");
[/code]

// Put a friendly message on the terminal console.log("TCP server listening on port 1337 at localhost.");

Then I run node test.js Response : TCP server listening on port 1337 at localhost.

Then I go to www.mywebsite.com:1337

Oops! Google Chrome could not connect to www.mywebsite.com:1337

So I tried using the actual IP server.listen(1337, "xx.xx.xx.xx");

And the URL server.listen(1337, "http://mywebsite.com"); // this actually broke the server immediatly

So how can I do this?

You will need a firewall rule to allow incoming traffic.

iptables -A INPUT -p tcp --dport 1337 -j ACCEPT

and do not bind to localhost, but on the port only:

server.listen(1337/*, "localhost"*/);

http://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback

EDIT: This comments out the host, so your server will listen on all adresses (this is the same as:)

server.listen(1337);

If you still encounter problems, this is most likely a firewall problem.