0
点赞
收藏
分享

微信扫一扫

阿里云配置tomcat后外网不能访问


今天自己在阿里云服务器上弄tomcat,结果因为外网一直无法连接弄了一下午,终于解决了,因此把我的经历记录下来,希望能够帮到遇到同样问题的你

网上搜了很多,无非都是让添加

 

阿里云配置tomcat后外网不能访问_tomcat

阿里云配置tomcat后外网不能访问_阿里云_02

我也按照步骤做了,结果仍然无法访问,最终的解决方法是——还要在防火墙开启8080

 

防火墙操作

现在防火墙有两种服务

1.service firewalld 

2.service iptables 

一.就firewalld来说,常用命令

查看开放的端口

netstat -anp

查询防火墙状态

service firewalld status

防火墙开启

service firewalld start

查询对应端口号

firewall-cmd --query-port=8080/tcp

如果显示no,则开启

firewall-cmd --add-port=8080/tcp --permanent

然后重启防火墙

firewall-cmd --reload

列出已经打开的端口

firewall-cmd --list-all

二.service iptables 常用命令

开放端口

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

保存

/etc/rc.d/init.d/iptables save

重启服务

/etc/init.d/iptables restart

查看端口是否开放

/sbin/iptables -L -n

经过在阿里云服务上配置安全规则和在防火墙上添加8080端口,我的问题终于解决了,希望也能对你有用

 

参考:


https://www.jianshu.com/p/add543fb9167

https://yq.aliyun.com/articles/226979?spm=5176.13394999.0.0.59b86114hhgCzz&aly_as=kVZWkne1

 

 

 

举报

相关推荐

0 条评论