Spring Boot Application deployed on Elastic Beanstalk Java environment returns 502

Question:

I’m trying to deploy a very simple Spring Boot application on AWS Elastic Beanstalk using AWS’s Java configuration (not their Tomcat configuration), but I keep getting a 502 error with the following log:

I’ve tried setting my port via Spring’s application.properties to what the log seems to want (5000, using server.port=5000) and have verified that my application runs successfully on that port on localhost.

This question is very similar, except that I’m deploying a JAR instead of a WAR. It seems like there is something I’m missing regarding configuring Nginx, and I don’t know how to proceed.

Here’s my Spring Application:

Answer:

Nginx doesn’t know on which port your spring boot applicaiton is running.
Make application run on port 5000 that Nginx redirects to by default by adding “server.port=5000” to application.properties or other suggested ways in the last step:

https://pragmaticintegrator.wordpress.com/2016/07/12/run-your-spring-boot-application-on-aws-using-elastic-beanstalk/

Leave a Reply