http://blog.csdn.net/tmpbook/article/details/43734699
Analysis
504 Gateway Time Out
The reason is that because of the improper setting of the relevant parameters, it is easy to solve
When Nginx and UWSGI are integrated, there are three parameters that can be used to set the timeout time:
1.uwsgi_connect_timeout:
The default is 60 seconds, and the time-out for the Uwsgi-server connection, which cannot exceed 75 seconds. Disconnect attempt If the connection is unsuccessful during the timeout period
2.uwsgi_read_timeout:
The default 60 seconds, Nginx waits for the UWSGI process to send the response data time-out. This parameter needs to be increased if there is a uwsgi process that needs to run for a long time to produce output results. If you see it in the error log file
Upstream timed out this parameter should be increased. Nginx closes the connection if it has not received a response over the timeout period
3.uwsgi_send_timeout:
The default is 60 seconds, and Nginx sends the request time-out to the UWSGI process. The time-out period is calculated from the interval of two write operations, not the entire request. Nginx closes the connection if the timeout period is not written
In addition: Uwsgi itself also has a parameter harakiri, if each request needs to spend more than this value of time to discard the request, processing the corresponding worker is retracted my instance:
Uwsgi.ini
Nginx.conf
Xtyw_file.conf->location (This configuration takes effect via the include import in nginx.conf)