简体   繁体   English

Spring Boot网站在本地工作,但无法远程访问

[英]Spring boot website works locally but not accessible remotely

I was learning to program a website using spring boot and was trying to deploy a working version of my project to my cloud server. 我正在学习使用Spring Boot来对网站进行编程,并试图将我的项目的工作版本部署到我的云服务器上。 I used mvn clean install to build it in to a .jar file locally, then I uploaded it to my cloud server via sftp and ran it with java -jar mywebapp.jar . 我使用mvn clean install将其构建到本地.jar文件中,然后通过sftp将其上传到我的云服务器,并使用java -jar mywebapp.jar运行它。

Next I entered [my-server-ip]:8080 in my browser and got an empty response error. 接下来,我在浏览器中输入[my-server-ip]:8080 ,并得到一个空的响应错误。 So I ssh on to my server and ran w3m http://localhost:8080 , and w3m loaded the page successfully, which means the website is running correctly. 因此,我转到服务器并运行w3m http://localhost:8080 ,并且w3m成功加载了页面,这意味着网站运行正常。

I checked netstat -np and I got this: 我检查了netstat -np并得到了:

tcp6       0      0 :::8080                 :::*                    LISTEN      7297/java        off (0.00/0/0)

The cloud server is running Ubuntu 16.04 云服务器正在运行Ubuntu 16.04

Any idea what's happening here? 知道这里发生了什么吗?

事实证明,这是防火墙设置的一个问题,该设置阻止了除通过端口22的ssh外的所有入站流量。我添加了一条规则,允许端口8080上的传入http流量正常运行,现在它可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Boot Service在本地工作,但不能在远程工作 - Spring Boot Service works locally but not remotely JDBC连接可以在远程工作,但不能在本地工作 - JDBC connection works remotely but not locally 当本地一切正常时,Spring Boot Security 会导致应用程序在部署到 GAE 时关闭 - Spring Boot Security causes application to shutdown when deployed to GAE when locally everything works fine 使用 Spring 将图像上传到 Google Cloud 存储启动在本地工作,但在部署时它不起作用 - Image upload to Google Cloud storage with Spring Boot works locally but when deploy it doesn't work Spring Boot @ManagedResource 组件在 Docker 中启动时在 VisualVM 中不可见,但在本地工作 - Spring Boot @ManagedResource component is not visible in VisualVM when launched in Docker but works locally Spring 应用程序在本地工作,但不在 Azure - Spring app works locally but not on Azure ejb远程方法在本地工作,但远程给出错误 - ejb remote method works locally but give error remotely Spring Boot @Converter始终可以通过@SpringBootTest访问 - Spring Boot @Converter always accessible with @SpringBootTest 小程序在本地处理文件,但在网站上失败 - Applet processing a file works locally but fails in website Spring Boot @ExceptionHandler在开发服务器上工作,但不在本地 - Spring Boot @ExceptionHandler working on dev server but not locally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM