启动网页后端服务,127.0.0.1可以访问,外网地址不能访问

我使用的node的服务,端口8081,启动服务后127.0.0.1可以访问,外网地址不能访问

找出问题:

使用下面命令查看端口监听地址,图中可以看出端口监听的ip是127.0.0.1的ip(可知是端口监听的ip不对导致)

[root@localhost ~]#  netstat -anp | grep 8081

解决问题:

找到config文件夹下的index.js文件,修改host为0.0.0.0就可以了。

还有个可能是防火墙没关的问题:

关闭防火墙即可:

systemctl stop firewalld.service

systemctl disable firewalld.service

清除防火墙:iptables -F

查看防火墙状态:

firewall-cmd --state

systemctl status iptables

_Kc
发布了69 篇原创文章 · 获赞 9 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/qq_26775359/article/details/85088722
今日推荐