Solution for nginx “504 Gateway Time-out”

January 28, 2012 by
Filed under: server, troubleshooting 

When my website routes path /mybackup to pyramid application.”504 Gateway Time-out” occured. And I set  several fastcgi parameters in the nginx.conf a following:

 fastcgi_connect_timeout 300s;
 fastcgi_send_timeout 300s;
 fastcgi_read_timeout 300s;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 8 128k;

But it doesn’t work. And then found that nginx was proxy_pass the path to pyramid(wsgi), so the fastcgi config does not help (it only works for fastcgi), the complete configuration is:

location /mybackup {
       send_timeout 180;
       proxy_read_timeout 120;
       proxy_connect_timeout 120;
       index  index.jsp index.html index.htm;
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header  X-Real-IP  $remote_addr;
}
Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Comments

4 Comments on Solution for nginx “504 Gateway Time-out”

  1. Mohamed Tair on Sat, 4th Feb 2012 4:40 am
  2. I Have The Same problem 🙁

  3. Arif on Sun, 12th Aug 2012 6:11 pm
  4. Thanks, it works great from me

  5. P.V.Anthony on Thu, 11th Oct 2012 10:05 am
  6. Works great!

    Thank you for sharing.

    P.V.Anthony

  7. uelkfr on Mon, 30th Sep 2013 7:57 pm
  8. Thank you. I have changed in /etc/nginx/sites-enabled/mysite.com

    location /phpMyAdmin {

    # this is for waiting for reading from php5-fpm
    fastcgi_read_timeout 900s;
    }

    and in /etc/php5/fpm/pool.d/mysite_com.conf

    ; this for long execution of synchronize script in phpMyAdmin
    php_value[max_execution_time] = 900