title: AWS elastic Beanstalk / nginx : connect() failed (111: Connection refused
body: <p>I got this message</p>
  
  <pre><code>connect() failed (111: Connection refused
  </code></pre>
  
  <p>Here is my log:</p>
  
  <pre><code>-------------------------------------
  /var/log/nginx/error.log
  -------------------------------------
  2018/10/21 06:16:33 [error] 4282#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.4.119, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "hackingdeal-env.qnyexn72ga.ap-northeast-2.elasticbeanstalk.com"
  2018/10/21 06:16:33 [error] 4282#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.4.119, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8081/favicon.ico", host: "hackingdeal-env.qnyexn72ga.ap-northeast-2.elasticbeanstalk.com", referrer: "http://hackingdeal-env.qnyexn72ga.ap-northeast-2.elasticbeanstalk.com/"
  </code></pre>
  
  <p>I am using nodejs/express Elastic Beanstalk env.</p>
  
  <p>I have one nginx related file in</p>
  
  <pre><code>.ebextensions/nginx/conf.d/proxy.conf
  </code></pre>
  
  <p>Upper file contains:</p>
  
  <pre><code>client_max_body_size 50M;
  </code></pre>
  
  <p>Whenever I try to get my webpage I got 502 bad gateway.</p>
  
  <p>What's wrong with my app?</p>