阿里云上启动tomcat后访问不了,这是因为你没有添加防火墙的放行端口,在添加了tomcat的放行端口之后,还需要到阿里云控制台里面,找到阿里云的“安全组”规则添加这个端口才可以,也就是说阿里云做了双重控制,仅仅正确配置防火墙端口是不行的,还需要配置阿里云的实例安全组规则,两者都完成之后才能让tomcat被外部正常访问。附上防火墙相关的命令,注意:iptables在centos7中不使用了,需要开启防火墙,centos7中使用的是firewalld.
yum install firewalld //安装firewalld 防火墙 --开启防火墙 systemctl start firewalld 开机自动启动 # systemctl enable firewalld.service 关闭开机自启动 # systemctl disable firewalld.service 查看状态 #systemctl status firewalld 设置 firwall 使用firewall-cmd 命令 --增加可访问端口 firewall-cmd --zone=public --add-port=8080/tcp --permanent --重启防火墙(使修改生效) firewall-cmd --reload --看一下public区域下所有已打开的端口: firewall-cmd --zone=public --list-ports --查询某个端口是否放行 firewall-cmd --query-port=8080/tcp