tomcat7 - 无法远程连接到服务器(端口8080:拒绝连接)

时间:2017-01-31 22:27:40

标签: tomcat tomcat7

我正在使用PerfSONAR网络衡量工具,它具有依赖于tomcat7的UI。我在Ubuntu 14.04服务器上安装了perfsonar-ui,为了测试我的安装,我将浏览器(在Windows 7机器上)指向地址http://my_server_address:8080/perfsonar-ui/。连接失败。

到目前为止我尝试了什么:

  • 从多台机器ping到我的服务器都是成功的。
  • 服务器本身
  • curl -X GET http://localhost:8080/perfsonar-ui/,响应状态OK(200)
  • 其他服务器上的
  • curl -X GET http://my_server_address:8080/perfsonar-ui/会导致:

    curl: (7) Failed to connect to my_server_address port 8080: Connection refused

  • 允许服务器sudo ufw allow 8080上的端口8080

  • 禁用了服务器sudo ufw disable
  • 上的防火墙
  • 我绑定到0.0.0.0,因此/etc/tomcat7/server.xml文件中的连接符如下所示:

    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" address="0.0.0.0" />

  • netstat -ntlp | grep LISTEN结果:

    tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN -

还是不行! :(

有人可以帮我解决问题吗?感谢。

2 个答案:

答案 0 :(得分:2)

我正在关闭这个。它与tomcat无关。这是一个iptables问题,我不得不允许传入连接到目标端口8080.它工作正常!

答案 1 :(得分:0)

我找到了一个替代解决方案,只需用tomcat conf中server.xml中的端口80替换端口8080。然后再次停止并启动tomcat服务器。它在Ubuntu 16.4服务器上进行了测试。

ORIGINAL: 连接器 port =“8080” protocol =“HTTP / 1.1”

修饰: 连接器 port =“80” protocol =“HTTP / 1.1”

当我从我的网站使用CURL访问远程tomcat服务器时,它适用于我。

API网址应为“http://xxx.xxx.xxx.xxx/api/24”以代替“http://xxx.xxx.xxx.xxx:8080/api/24

相关问题