title: Inconsistent timeout errors on nginx server
body: <p>I have an application that is trying to make ajax requests from a Javascript application to retrieve xml files from an nginx server. Normally everything is fine but I often see errors in the nginx log (and get errors from my applications error reporting) that nginx expriences a timeout during the get:</p>
  
  <pre><code>2015/11/16 21:15:21 [error] 1208#0: *4894044 upstream timed out (110: Connection timed out) while connecting to upstream, client: 209.95.138.54, server: www.servername.com, request: "GET /Shape%20Textures/Metal/Born%20to%20Shine.jpg?agentView=436314 HTTP/1.1", upstream: "http://127.0.0.1:3000/AQO/Shape%20Textures/Metal/Born%20to%20Shine.jpg?agentView=436314", host: "www.servername.com.com", referrer: "https://www.servername.com.com/?nid=39956&amp;mode=edit"
  </code></pre>
  
  <p>We also sometimes get this similar error:</p>
  
  <pre><code>2015/11/17 19:03:16 [error] 1002#0: *54042 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 137.164.121.52, server: www.servername.com, request: "POST /projects/?q=node/36375/update_project_time_and_stats HTTP/1.1", upstream: "http://127.0.0.1:3000/projects/?q=node/36375/update_project_time_and_stats", host: "www.servername.com", referrer: "https://www.servername.com/AQO/?nid=36375&amp;mode=edit"
  </code></pre>
  
  <p>I have seem similar posts with similar timeouts but all of those posts seemed reproducible. This issue never happens to me but running on the live server I will see 5-30 of these timeouts a day. </p>
  
  <p>Here is my nginx config:</p>
  
  <pre><code>client_max_body_size 50M;
  
  server {
      server_name servername.com;
      return 301 $scheme://www.servername.com$request_uri;
  }
  
  server {
      listen 80;
      listen 443 ssl;
      fastcgi_read_timeout 120;
      ssl_certificate /path/to/ssl/star_servername_com.pem;
      ssl_certificate_key /path/to/ssl/star_servername_com.key;
  
      # Redirect all non-SSL traffic to SSL.
      if ($ssl_protocol = "") {
        rewrite ^ https://$host$request_uri? permanent;
      }
  
      root /usr/share/nginx/html;
      index index.html index.htm;
  
      # Make site accessible from http://localhost/
      server_name www.servername.com;
  
      location / {
              proxy_set_header X-Forwarded-For $remote_addr;
              proxy_pass http://127.0.0.1:3000;
              proxy_read_timeout 120s;
      }
  }
  </code></pre>
  
  <p>Since I can't reproduce it I wonder how might I be able to track down this issue?</p>