[英]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.