Django+uwsgi+nginx-Error: nginx:504 Gateway Time Out

Source: Internet
Author: User
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 example:

Uwsgi.ini

Nginx.conf

Xtyw_file.conf->location (This configuration takes effect via the include import in nginx.conf)

The above describes the Django+uwsgi+nginx-error: nginx:504 Gateway time out, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.