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