In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what to do when LNMPA encounters 504 Gateway time-out errors". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what to do when LNMPA encounters 504 Gateway time-out errors".
The characteristic of Nginx is that it is very powerful to deal with static, and the characteristic of Apache is that it is very stable to deal with dynamic. The combination of the two is the front end of LNMPA,nginx processing and the back end of apache processing, so static processing will be very fast and dynamic processing will be very stable.
When I thought everything would be all right after the installation, only to find 504 Gateway time-out; when I updated the site. At first I thought it was an accident, but it still happened after many attempts, so I decided to find a solution.
LNMP faces 504 Gateway time-out because 504 Gateway time-out is the exclusive error of Nginx, so at first I thought it was a mistake in nginx configuration. Look for tutorials on the Internet and find the corresponding solution. Here is a brief talk about LNMP's solution to this situation. Nginx has such an error because the limit on the number of PHP-CGI processes is too small, and in the face of operations such as updating the website, there are likely to be insufficient processes and timeouts, so you have to modify two files that involve processing time. First of all, the nginx.conf file, this file in / nginx/conf/nginx.conf, after opening, mainly modify the first few times, it is recommended to modify to more than 120 seconds.
As for what tool to use to modify it, it is recommended to edit it online on the command line, or download it with winscp and modify it with Dreamweaver.
Fastcgi_connect_timeout 300s; fastcgi_send_timeout 300s; fastcgi_read_timeout 300s; fastcgi_buffer_size 128k; fastcgi_buffers 8 128k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k
Second, modify the php-fpm.conf file, which is located in / php-5.2.17/etc/php-fpm.conf. Different one-click installation packages are located in different locations.
Anyway, look for the etc folder under the files after php installation, and edit it online or download it with Dreamweaver.
After entering the file, search for "max_children". This is the number of php-cgi processes. A process occupies 20M~30M memory and is calculated according to its own VPS or CVM memory, such as 512m memory. It is recommended to set it to 18.
In addition, search for "request_terminate_timeout". This is the timeout. If the php program is to run for a long time, it would be better to set it a little longer, such as 120 seconds, the unit defaults to seconds, or 120.
LNMPA encounters 504 Gateway time-out when I set it up according to the solution of Nginx, but 504 Gateway time-out still occurs. Then I switch directly to LNMP combination and find that I no longer encounter 504 Gateway time-out error, which indicates that the setting has already taken effect. Why does such an error still occur?
After a lot of information search, it is finally found that this is a problem with the communication time setting between Nginx and Apache. When a user issues a request for php script execution, nginx will not execute php.
The apache,nginx that will leave this problem to the background will wait for a period of time. Apache can process the php script request within the waiting time. If it is not finished, nginx will not receive the data request and return a 504Gateway time-out error. In fact, apache will still finish processing the php script in the background, but the foreground will return an error.
The solution is to modify the communication time between nginx and apche, specifically by configuring proxy.conf. If the file is under / nginx/conf/, the name may change, for example, some installation packages are laproxy.conf, but they are * * proxy.conf files anyway.
Proxy_connect_timeout 60; proxy_send_timeout 600; proxy_read_timeout 90; proxy_buffer_size 128k _ busy_buffers_size 256k; proxy_temp_file_write_size 100m
The first is the connection time, the front-end connection back-end time is less than 60s, the second is the sending time, the time allowed to return data from the back-end is less than 90s, and the third time is the read-write time, which is the root cause of 504 Gateway time-out. This error indicates that this value is too small, recommended not less than 600s, and the worse the server is, the longer the setting will be. Make sure it's done.
When I set up this file, restart nginx and apache, and update the article again, I will no longer encounter this kind of error, indicating that the reason for the error is not nginx, but that the communication time between the front end and the back end is too short.
In addition, nginx will also have 502 errors, in fact, the principle is similar, also set the above part of the file, LNMPA combination is still set the front and back end communication time.
The above is all the content of this article "what to do if LNMPA encounters 504 Gateway time-out errors". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.