title: Nginx reverse proxy causing 504 Gateway Timeout
body: <p>I am using Nginx as a reverse proxy that takes requests then does a proxy_pass to get the actual web application from the upstream server running on port 8001.</p>
  <p>If I go to <code>mywebsite.example</code> or do a wget, I get a 504 Gateway Timeout after 60 seconds... However, if I load <code>mywebsite.example:8001</code>, the application loads as expected!</p>
  <p>So something is preventing Nginx from communicating with the upstream server.</p>
  <p>All this started after my hosting company reset the machine my stuff was running on, prior to that no issues whatsoever.</p>
  <p><strong>Here's my vhosts server block:</strong></p>
  <pre><code>server {
      listen   80;
      server_name mywebsite.example;
  
      root /home/user/public_html/mywebsite.example/public;
  
      access_log /home/user/public_html/mywebsite.example/log/access.log upstreamlog;
      error_log /home/user/public_html/mywebsite.example/log/error.log;
  
      location / {
          proxy_pass http://xxx.xxx.xxx.xxx:8001;
          proxy_redirect off;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  <p><strong>And the output from my Nginx error log:</strong></p>
  <pre><code>2014/06/27 13:10:58 [error] 31406#0: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client: xxx.xx.xxx.xxx, server: mywebsite.example, request: &quot;GET / HTTP/1.1&quot;, upstream: &quot;http://xxx.xxx.xxx.xxx:8001/&quot;, host: &quot;mywebsite.example&quot;
  </code></pre>