In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "php-fpm 502 bad gateway error handling example analysis", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn the "php-fpm 502 bad gateway error handling example analysis" this article.
In recent month, there are frequent customer service calls to complain about 502errors on the page. At first, I thought it was a problem of running the game program (because it is useless to restart the php-fpm process, it can only be restored by restarting the game). Later, the situation became serious: even the forum had 502errors. In order not to wait for the leader to invite tea, I quickly checked the nginx log and found all kinds of errors in the past few days. 111104: Connection reset by peer
[error] 31329: * 1027762 connect () failed (111l: Connection refused) while connecting to upstream .upstream: "fastcgi://127.0.0.1:9000",.
Roughly, the php timeout setting is too small, and the nginx fastcgi cache setting is too small.
Later, I checked the nginx configuration, fastcgi_buffers and connection timeout, which are all default configurations. The php-fpm.conf timeout was also set for 30s. I felt that I was trapped by php development and the original OPS. I changed these things decisively and cruelly as follows:
Add in the nginx.conf http section
Fastcgi_connect_timeout 300 is fastcgitized, sendings, timeout 300, fastcgigs readout 300, fastcgigs, buffers, buffers.
Put request_terminate_timeout = 300 in php-fpm.conf
The php-fpm timeout setting here is a little larger, so let's set it according to the actual situation.
Description:
Fastcgi_connect_timeout specifies the timeout for connecting to the backend FastCGI
Fastcgi_send_timeout specifies the timeout for delivering the request to FastCGI
Fastcgi_read_timeout specifies the timeout for receiving FastCGI replies
Fastcgi_buffers 464k sets up four buffers, each 64k, with a total size of (4x1) * 64k. The default is 4k or 8k consistent with the page size of the system.
Function: if a PHP script produces a page size of 256KB, it will be allocated 4 64KB buffers to cache; if the page size is larger than 256KB, the parts larger than 256KB will be cached in the file path specified by fastcgi_temp
Fastcgi_buffer_size 64k refers to the buffer size of the header corresponding to the FastCGI server, which is usually the same as a buffer size of fastcig_buffers.
The default value of fastcgi_busy_buffers_size is twice that of fastcgi_buffers
Fastcgi_temp_file_write_size indicates the size of the data block used when writing to the cache file, and the default value is twice that of fastcgi_buffers
The execution time of request_terminate_timeout php timed out, which can solve the problem of Connection reset by peer
Restart php-fpm restart nginx
The above is all the contents of the article "sample Analysis of php-fpm 502 bad gateway error handling". 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.