繁体   English   中英

Linux Node JS在端口80上侦听,但不在其他端口上侦听

[英]Linux Node JS listening on port 80 but not on other ports

我是Linux的入门级...

我让节点JS监听80端口,一切正常。

但是,当尝试使用其他端口时,它将不起作用。

Firewalld is not enabled...

当在浏览器中尝试时,我尝试localhost:8080

有任何想法吗?

如果已经运行,请停止防火墙

 sudo systemctl stop firewalld

检查iptable的状态

如果尚未安装,请使用

yum install iptables-services

sudo systemctl status iptables

在启动时启用服务:

systemctl enable iptables

管理服务

systemctl [stop|start|restart] iptables

保存防火墙规则可以如下进行:

service iptables save

使用此命令启动并启用防火墙

sudo systemctl start firewalld
sudo systemctl enable firewalld

配置防火墙并添加IP和要启用的端口范围(可选)

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

上面的命令采用IP和端口的范围。 您需要在上面的命令中替换IP和端口范围,请确保更改xxxx / n,这里n是端口数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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