Recently, server downtime occurs frequently. When I get off work, G crashes and 502 Bad Gateway Nginx reminds me of the previous 504 Gateway Time-out, the two should be in a certain relationship. Nginx 504 Gateway Time-out means t
. conf:Fastcgi_connect_timeout 300 s;Fastcgi_send_timeout 300 s;Fastcgi_read_timeout 300 s;Fastcgi_buffer_size 128 K;Fastcgi_buffers 8 128 K; #8 128Fastcgi_busy_buffers_size 256 K;Fastcgi_temp_file_write_size 256 K;Fastcgi_intercept_errors on;The most important setting here is the first three, that isFastcgi_connect_timeout 300 s;Fastcgi_send_timeout 300 s;Fastcgi_read_timeout 300 s;This specifies the connection, send, and read time for the PHP-CGI, 300 seconds is enough, so my server rarely get
Recently, the phenomenon of server downtime more frequent, temporary work, G to hang up, 502 Bad Gateway Nginx, I can not help but remind me before the 504 gateway time-out, the two should be a bit of contact, we must find out. The implication of Nginx 504
In the Nginx reverse proxy mode, the page loading is incomplete or the 502 bad gateway appears directly.
There are many cases of 502 bad Gateway, most of which are related to the setting of the Nginx timeout problem. The following is a discussion of a situation that is relatively rare but has to be noted.
Presence
report 502 errors without any effect.② Refresh from the server: If you click the link of the web page you want to browse again, you will find that the 502 bad getway page is still displayed and can be viewed again now!Why? When you click the webpage link you want to browse, the data will be re-downloaded from the server.The solution is to refresh the server: press ctrl + F5 to send a new request to the server.If the server can respond to you normally
results, look forward to your discovery ha!Second, Nginx 502 bad GatewayThe implication of Nginx 502 Bad Gateway is that the requested php-cgi has been executed, but the php-cgi process is terminated for some reason (generally, the problem of reading the resource) is not completed.The implication of Nginx 504
, many things require long-term experience to produce results. We look forward to your findings!
Nginx 502 Bad Gateway means that the requested PHP-CGI has been executed, but the PHP-CGI process is terminated for some reason (generally because the problem with reading resources) is not completed.Nginx 504 gateway ti
time-out situation, is achieved effect.
In addition, the default static processing of PHP-FPM can make the process of php-cgi to occupy memory for a long time and cannot be released, which is also one of the causes of Nginx error, so can change the PHP-FPM processing mode to Apache mode.
From the changes completed to the present test shows that the effect of the above method is still very obvious, and did not find a Nginx502 bad
completed to the present test shows that the effect of the above method is still very obvious, and did not find a Nginx502 bad gateway or 504 Gateway time-out error. Of course, if your VPS or server performance is good enough to be based on the specific circumstances do not have to make unnecessary changes.
Instance
understand the technology, in my dedecms5.6 inside useful, others try it.
Nginx 502 Bad Gateway means that the requested php-cgi has been executed, but the php-cgi process is terminated for some reason (typically a problem reading the resource) is not completed.
The implication of Nginx 504 Gateway time-out is that
Nginx is characterized by the handling of static is very strong, Apache is the characteristic of processing dynamic is very stable, the combination of the two is Lnmpa,nginx processing front end, Apache processing the backend, so the processing of static will soon, processing dynamics will be very stable. When I think the installation is finished, and behold, when the site was updated 504 Gateway time-out;
;Fastcgi_busy_buffers_size is changed from 128 K to 256 K;Fastcgi_temp_file_write_size is changed from 128 K to 256 K.Okay, reload the configuration of php-fpm and nginx, and test again. So far, No 504 Gateway Time-out has been found in two weeks.In addition, the default static Processing Method of php-fpm will make the php-cgi process occupy the memory for a long time and cannot be released, which is also
Remember a puzzling site lost response to the troubleshooting. The site has been using Nginx to do proxy back-end Apache running PHP to provide services. Apache often does not have a regular time to be unable to service loss of response, and then nginx appear "504 Gateway time-out"Looking at the error log also does not see anything that is the Apache bug (in fact not, the following will say why).
Perhaps o
Today the program in the execution of an Excel export task, there is an Nginx timeout promptNginx 504 Gateway Time-outTroubleshooting process:View the task discovery content is a data volume 20,000 information each piece of information has 50 fields when you perform the export to Excel, the problem occursExecution time expires in about 10 minutesAnalysis:The implication of Nginx
Do site students often find some Nginx server access when prompted 504 Gateway time-out error, generally by the Nginx default fastcgi process response slow, but there are other situations, here I summed up some solutions for your reference.Method/Step
Situation one: Due to nginx default fastcgi process response buffer too small causedThis situation causes the FASTCGI process to be suspended, and if the
Problem
Win7 installed on the nginx1.6.2 official website version + Wamp PHP Library, and then the program has PHP use Curl to collect a remote program, but always appear 504 Gateway Time-out prompt! Using PHP inside Wamp, no php-fpm, how to modify max_children parameters?
Startup code
@echo offREM Windows 下无效REM set PHP_FCGI_CHILDREN=5REM 每个进程处理的最大请求数,或设置为 Windows 环境变量set PHP_FCGI_MAX_REQUESTS=1000echo Sta
Nginx and php-fpm 504 Gateway Time-out troubleshooting and SolutionsMany people may have encountered 504 Gateway Time-out. Sometimes it is confusing.Solution:1. Baidu allows many people to say that you can adjust the nginx configuration or php-fpm configuration, and you can configure Baidu. However, many of them have t
Using PHP today to execute a very time-consuming file "PS: self-useful, about 3 minutes"But the execution is shown after one minuteNginx 504 Gateway Time-outSo modify Max_execution_time = 1200 in the php-ini.php, restart PHP, or no useSuddenly understand that if the timeout is a problem with PHP settings, the following error will be reportedFatal error:maximum execution time of seconds exceeded in E:\ceshi\
Tags: HTTP ar file on art code ad ef
My friend said that the error message 504 gateway time-out has nothing to do with nginx itself. We can solve this problem by adjusting the FastCGI configuration parameters.
.
Modify the PHP-FPM configuration file:
1. Modify max_children according to the system to ensure that there are sufficient PHP-CGI processes available;
Modify the PHP-FPM configuration file
The Uwsgi+nginx deployed Web site runtime may produce errors such as 504 Gateway time out, due to improper setting of the relevant parameters.Nginx and Uwsgi integration with three parameters can be used to set the time-out period, in the Nginx configuration file http->server->location set.Uwsgi_connect_timeout: The default is 60 seconds, and the timeout for the Uwsgi-server connection cannot exceed 75 seco
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.