转:Linux中tomcat服务成功发布但局域网浏览器无法访问,linuxtomcat


转自:http://blog.csdn.net/mooncom/article/details/53168143

昨天,我在搭建Linux中服务器环境时,碰见一个问题,这里和大家分享一下。

问题描述:我在linux搭建了一个tomcat服务器,tomcat开启后,发现在局域网浏览器上无法访问该tomcat,浏览器报无法访问服务器错误,我查看了tomcat的日志,路径..../tomcat/logs/catalina.out,发现tomcat在开启过程中没有报错。我又查看了一下工程日志,也没有错误。

service iptables status   #查看防火墙状态

解决方法:上网搜索,发现很多人都遇到过这个问题,这是Linux防火墙开启导致的,网上的方法大多是通过以下的指令启停

service iptables stop #停止 chkconfig iptables off #禁用
但是,因为我装的Linux系统是 centos 7,所以,上面这两条指令在改Linux中无法执行,报以下错误:

Redirecting to /bin/systemctl stop  iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.

在不同Linux系统中,操作指令大体上都是相同的,但是不同的系统仍会有细微的差别,我们经常使用的是red hat。对于red hat来说,上面这两条停止、禁用可用,但是对于centos 7系统来说,只有使用下面的指令,才可以对Linux防火墙进行启停。

systemctl stop firewalld.service #停止 systemctl disable firewalld.service #禁用

相关内容