django+uwsgi+nginx - 错误:nginx:504 Gateway Time out

WBOY
Release: 2016-08-08 09:29:43
Original
1351 people have browsed it

Analysis

504 Gateway Time out

The reason is due to improper setting of relevant parameters, which is easy to solve

When integrating nginx and uwsgi, there are three parameters that can be used to set the timeout:


1.uwsgi_connect_timeout:

The default is 60 seconds. The timeout for connecting to uwsgi-server. This value cannot exceed 75 seconds. If the connection fails within the timeout period, a disconnection attempt will be made

2.uwsgi_read_timeout:

The default is 60 seconds. The timeout period for nginx to wait for the uwsgi process to send response data. If there is a uwsgi process that needs to run for a long time to produce output results, you need to increase this parameter. If you see
in the error log file Upstream timed out needs to increase this parameter. If no response is received after the timeout period, nginx closes the connection

3.uwsgi_send_timeout:

The default is 60 seconds, the timeout period for nginx to send requests to the uwsgi process. The timeout is calculated by the time between two write operations, not the entire request. If there is no writing action after the timeout period, nginx closes the connection


In addition: uwsgi itself also has a parameter harakiri. If each request takes more time than this value, the request will be abandoned and the corresponding worker will be taken back


My example:

uwsgi.ini

nginx.conf

xtyw_file.conf->location (this configuration takes effect through the include import in nginx.conf)

The above introduces django+uwsgi+nginx - Error:nginx:504 Gateway Time out, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!