title: Nginx, and mysql timeout - upstream timed out (110: Connection timed out)
body: <p>My stack is uWSGI with the gevent loop, flask, mysql, and the python mysql.connector s I can make async mysql queries.  Lateley I have been getting the below error in the nginx logs when i run a query.  Can take upto 60 secs for a query to complete.  Out side of the stack the query works.  When I run using the built in flask dev server locally on my laptop and hit the mysql server halfway around the world..it works.  So..I assume a nginx configuration issue.</p>
  
  <pre><code>2013/01/05 01:49:48 [error] 7267#0: *2878 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: 127.0.0.1, request: "GET /ajax_grid?date_from=2013-01-02&amp;date_to=2013-01-04&amp;rt=crpr&amp;a_dhx_rSeed=1357350534901 HTTP/1.1", upstream: "uwsgi://127.0.0.1:6000", host: "test.com", referrer: "http://test.com/"
  </code></pre>
  
  <p>Below are my relevant options for nginx.  What should I tweak to not get the error?</p>
  
  <pre><code>sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  keepalive_requests 100000;
  types_hash_max_size 2048;
  proxy_read_timeout 200;
  reset_timedout_connection on;
  client_body_timeout 60;
  send_timeout 2;
  # server_tokens off;
  # server_names_hash_bucket_size 64;
  # server_name_in_redirect off;
  
  server {
          listen   80;
          server_name 127.0.0.1;
  
  
  
      location / {
                     include uwsgi_params;
                     uwsgi_buffering off;
                     #uwsgi_param X-Real-IP $remote_addr;
                     #uwsgi_param Host $http_host;
                     #uwsgi_pass uwsgi_dashboard;
                     uwsgi_pass 127.0.0.1:6000;
               }
  </code></pre>