简体   繁体   中英

Linux Node JS listening on port 80 but not on other ports

I am a starting level at linux...

I got node JS to listen to port 80 and everything works well.

But when trying different ports it doesn't work.

Firewalld is not enabled...

and when trying in the browser I try localhost:8080

Any Ideas?

Stop firewall if already running

 sudo systemctl stop firewalld

Check the status of iptable

If not already installed then install it using

yum install iptables-services

sudo systemctl status iptables

Enable the service at boot-time:

systemctl enable iptables

Managing the service

systemctl [stop|start|restart] iptables

Saving your firewall rules can be done as follows:

service iptables save

Start and Enable Firewall with this command

sudo systemctl start firewalld
sudo systemctl enable firewalld

Configure firewall and add Ip and range of ports to be enabled (optional)

firewall-cmd --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="11224-12224" protocol="tcp" accept'

The above command takes the range of IPs and ports. You need to replace the IP and port range in the above command, make sure to change the xxxx/n , here n is the number of ports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM