Nginx appears 504 Gateway time-out solution

Source: Internet
Author: User

When using Nginx as a Web server, you will often encounter 504 Gateway time-out error prompts. After research, basically can be determined that this error in most cases is not related to Nginx itself, the root of the problem is nginx to submit the parsing of PHP to the backend php-fpm process, due to improper configuration of the fastcgi parameters caused by a series of problems.

Through the query related data, summed up the fastcgi configuration parameters adjustment Scheme, for your reference, in detail as follows:

To modify the PHP-FPM configuration file:

1. Change the Max_children to 64 to ensure that sufficient php-cgi processes can be used;
2. Change the request_terminate_timeout to 60s so that the php-cgi process script timeout is 60 seconds, which prevents the process from being suspended and improves utilization efficiency.

Modify the nginx.conf file as follows:

Fastcgi_connect_timeout 60;
Fastcgi_send_timeout 180;
Fastcgi_read_timeout 180;
Fastcgi_buffers 4 256k;
Fastcgi_buffer_size 128k;
Fastcgi_busy_buffers_size 256k;
Fastcgi_temp_file_write_size 256k;
Fastcgi_intercept_errors on;

Nginx appears 504 Gateway time-out solution

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.