Can't connect to my Node.js server
6,209
Try another port. 3000 should work.
Related videos on Youtube
Author by
Thomas Clackston
Updated on September 18, 2022Comments
-
Thomas Clackston over 1 year
I have a VPS (on linode) where I installed Node.JS on.
My server.js file is as follow:
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337); console.log('Server running on port 1337');
When I try this on my server:
wget http://localhost:1337
It does work and downloads the response. But externally, Google Chrome is saying Oops! Google Chrome could not connect to xxx.xxx.xx.xx:1337
This is the output of the Iptables:
Chain INPUT (policy ACCEPT) target prot opt source destination fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh ACCEPT all -- anywhere anywhere REJECT all -- anywhere loopback/8 reject-with icmp-port- unreachable ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT icmp -- anywhere anywhere LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: ' DROP all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:4711 ACCEPT tcp -- anywhere anywhere tcp dpt:1337 ACCEPT tcp -- anywhere anywhere tcp dpt:1337 Chain FORWARD (policy ACCEPT) target prot opt source destination DROP all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp spt:1337 Chain fail2ban-ssh (1 references) target prot opt source destination RETURN all -- anywhere anywhere
What could be wrong? Thanks!