title: AWS Elastic Beanstalk : 502 Bad Gateway nginx/1.14.1 Spring boot application - tried port 5000
body: <p>I've deployed a simple Spring boot application to Elastic Beanstalk but when I try to access /serviceinfo , or any path for this purpose, it's always showing <code>Health
  Degraded</code> in the dash board I get this error 
  502 Bad Gateway nginx/1.14.1</p>
  
  <p>The app works locally</p>
  
  <p>but on EBS logs I read :
  <code>2019/03/02 06:55:49 [error] 3298#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 111.215.59.25, server: , request: "GET /serviceinfo HTTP/1.1", upstream: "http://127.0.0.1:5000/serviceinfo", host: "myservice.us-east-1.elasticbeanstalk.com"</code>
  Because I've deployed other Spring boot applications in the past, I know about <code>server.port=5000</code>, I've set it in my Spring Application properties, and when it didn't work I've set it again in EBS as an environment variable.
  but I still get the same error.
  Also used <code>SpringBootServletInitializer</code> in the main class, but that didn't help either.</p>
  
  <p>What else can I try to make it run</p>