在EC2上公开Spring Boot应用程序

时间:2018-10-30 22:57:03

标签: java spring-boot amazon-ec2

尝试在EC2实例上运行Spring Petclinic应用程序:

sudo yum install -y git
git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
./mvnw package
java -jar target/*.jar -Dserver.address=0.0.0.0

应用程序运行良好,可以在http://localhost:8080上访问。但是尝试使用公共IP地址访问会超时。

已经在How to configure embedded Tomcat integrated with Spring to listen requests to IP address, besides localhost?看到了建议,并尝试在server.address中指定application.properties,重新构建并重新部署了该应用程序。 How to setup spring-boot to allow access to the webserver from outside IP addresses也暗示类似。

不建议这样做,但是对所有端口的所有入站TCP通信都打开了EC2实例安全组。

还有什么可能是错的?

0 个答案:

没有答案