node.js - Unable to access nodejs server from outside network -


i have created node js server , not able access outside network.

var express = require('express');     var nodeapp = express();  var http = require('http'); var server = http.createserver(handlerequest); function handlerequest(request, response){         console.log("got request" + request);         response.end("response" + request.url); }   server.listen(8086, "0.0.0.0", function() {         console.log("http server on "); }); sudo iptables -l chain input (policy accept) target     prot opt source               destination           chain forward (policy accept) target     prot opt source               destination           chain output (policy accept) target     prot opt source               destination  

my iptables don’t show anything. have tomcat server on port 8080 , am able access that.

if you're using base install of redhat have selinux enabled.

long story short selinux , related question can open , close ports http access. manipulating things iptables not necessary. standard ports 80 , 8080 typically open in initial setup.

https://wiki.centos.org/howtos/selinux

refer section 5.4

we may want service such apache allowed bind , listen incoming connections on non-standard port. default, selinux policy allow services access recognized ports associated services. if wanted allow apache listen on tcp port 81, can add rule allow using 'semanage' command:

semanage port -a -t http_port_t -p tcp 81  

a full list of ports services permitted access selinux can obtained with:

semanage port -l  

Comments