NginX: Gateway Time-Out

One of the web server that run on Nginx is having 504 Gateway Time-out error. This can be fixed by increasing the send_timeout directive in nginx.conf.

Steps as below:

1. Open the nginx configuration files via your favourite text editor:

$ vi /usr/local/nginx/nginx.conf

2. Find send_timeout directive and increase the value higher. In this case, I increase the value from 3m to 10m:

send_timeout 10m;

3. Save the file and reload nginx using following command:

$ kill -HUP `ps -ef | grep nginx | grep master | awk {'print $2'}`

Notes: Some user might still get this error after applying the solution. It also depending on how your application works. Other directives that need to be consider for this error are:

client_header_timeout
client_body_timeout
send_timeout
fastcgi_read_timeout

3 thoughts on “NginX: Gateway Time-Out

  1. Did that (3600 was my value for up to 1 hour) but still no dice.. times out in 60 seconds. I checked all other values.. under fastcgi etc. But nothing.

    Jeff KeeNo Gravatar Reply

    1. You might need to check another area as your application might different requirement. I have updated the post by adding Notes.

      SecaGuyNo Gravatar Reply

  2. The following directive can solve this problem:
    fastcgi_buffers 256k
    fastcgi_buffer_size 128K
    fastcgi_busy_buffers_size 256K
    fastcgi_temp_file_write_size 256K

    LampkNo Gravatar Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>