In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Computer Software News >
Share
Shulou(Shulou.com)05/31 Report--
When we visit the high-traffic website phpcms or operate a website with more data, there will occasionally be 504Gateway Time-out errors, so how to solve the problem of Nginx 504gateway time-out? What does 504 gateway time-out nginx mean? Let's take a look at it with the editor.
What do you mean, 504 gateway time-out nginx?
504 Gateway Time-out literally, we can understand that the page request timed out, and the request made by browsing the web page did not respond or did not respond. At the phpcms level of the website, the request failed to execute the corresponding PHP-CGI program, or the PHP-CGI program failed to deal with it accordingly, or the response processing result of the CGI program failed to be fed back to the browser or failed to feedback to the browser in time.
What about Nginx 504 gateway time-out?
Most of the Gateway Time-out errors exist in the environment of Nginx website server, which is related to whether the settings of nginx.conf and php-fpm.conf are correct and reasonable. The solution to 504GatewayTime-out error is to consider many factors, such as website server performance and website traffic, and set niginx.conf and php-fpm.conf configuration correctly and reasonably.
To make a correct and reasonable nginx.conf configuration, we need to first understand and understand the configuration performance of our website server, including CPU, memory, etc., and conduct necessary performance tests on the website server, so as to accurately grasp the performance of the website server itself.
Secondly, through the addition of website statistical code, analyze the website traffic situation over a period of time, such as Baidu statistics, CNZZ webmaster statistics, etc., to grasp the general situation of daily website traffic and PHP-CGI requests.
According to the server performance and network traffic we have mastered, the following words in nginx.conf are reasonably and correctly set.
The setting of these words specifies the time limit for PHP-CGI to connect, send and read, which needs to be set according to server performance and network traffic. Too long a time setting will cause pressure on the website server, resulting in slow response of the website, or even server downtime; if the time setting is too short, 504 Gateway Time-out or other CGI non-response errors will occur.
There is also the setting of two important parameters max_children and request_terminate_timeout in php-fpm.conf.
The setting of these two parameters requires us to comprehensively consider and calculate reasonable and accurate values according to the PHP program and the server bandwidth, in order to avoid 504Gateway Time-out or other CGI non-response errors.
In general, the request_terminate_timeou can be set at about 900s for general websites, while the max_ child value is set to a reasonable value, about 800m, according to the server memory size and the number of CGI requests.
In addition, there are the following reasons for 504 gateway time-out:
(1) the first thing you need to make sure is whether the backend server is started or not. Of course, in this case, php-fpm does not start it.
(2) the second is to determine whether the worker process of php-fpm is sufficient.
(3) the caching of FastCGI cache or proxy.
(4) the execution time of PHP is long.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.