Yesterday, a program needs to export 500 data, the result found that 150 is, Nginx reported 504 Gateway timeout error
After observation, it was found that about 30 seconds timed out, the execution time in php.ini is 300 seconds:
Copy Code code as follows:
Max_execution_time = 300
Check the rela
Reprint article Source: http://www.111cn.net/sys/nginx/90669.htm (if invasion delete)
Nginx Newspaper 504 Gateway Timeout error caused, one is the file configuration problem, the other is related to the length of processing, and finally there may be insufficient resources, the following we look at.
Explained as follo
Recently in the work, the need to do Excel import function, because of the Excel data is more, and our server program needs to check the content of the data, will call a lot of external service interface, so no suspense import Excel interface call more than a minute, and error: 504 Gateway Timeout Here are two ways to solve this problem:
1. Optimize business code
An interface called for more than a minute
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
Yesterday, a program needs to export 500 data, the results found that 150 is, Nginx reported 504 Gateway timeout errorIt was observed that time-outs of about 30 seconds were found, and the execution times in php.ini were 300 seconds:Copy CodeThe code is as follows:Max_execution_time = 300Re-check the relevant configura
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
123systems VPS Put there for a long time no use, just W2 was stopped a few days, really boring, want to put the beautiful picture or put on the top, so, direct card wipe reload the 123systems VPS system, the small memory of the cutter, nature does not get the panel, direct LNMP, As a result, unexpected problems arose.
VPS Installation Lnmpa All the way smoother, seemingly long time, spent 2 hours or so (he
Project development almost, when deployed to the build environment, one of the features of a synchronized fan reported a mistake.
There are no problems with just a few dozens of fans, but when testing a fan with 5000 of the public number, the following error occurs.
Well, it's been a long time, so modify the server configuration
Proxy_connect_timeout 1800;Proxy_send_timeout 1800;Proxy_read_timeout 1800;
Decisively change the
Action (8): Error-26608:http status-code=504 (Gateway time-out)
If a problem arises,1. Tools in VUser Generator--->recording Options ...--->recording--->http-based script--->html Advanced button---> select a in the script type a script containing explicit URLs only (e.g.web_url,web_submit_data) click "OK"2.runtime-setting, browser emulation, deselect download no
/home/www/uninum/web.php on line 50PHP message:php notice:trying to get property of Non-object in xxx.php on line ' while reading response headers from U PstreamSync Settings file_get_contents TimeoutPHP file_get_contents Get file timeout processing and post and multiple retries$opts Array ( ' http ' = =array( ' method ' = "GET", ' timeout ' =>300, ) ); $context stream_context_create ($opts); $html =file_get_contentsfalse$contextPHP query database is slow,
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
which Network B forwards data packets to Network.Therefore, only the IP address TCP/IP protocol of the gateway can implement mutual communication between different networks. So which machine is the IP address of this IP address? the IP address of the gateway is the IP address of a device with the routing function. A device with the routing function has a router and a server with the routing protocol enable
, the higher you can set, 20 minutes-30 minutes can be done. Since my server PHP script takes a long time to run, some may take more than 10 minutes, so I set 900 seconds, this will not cause the PHP-CGI to die and the 502 Bad gateway error occurs.
Main modification parameters in nginxFastcgi_connect_timeout 1800;Fastcgi_send_timeout 1800;Fastcgi_read_timeout 1800;Fastcgi_buffer_size 1024 k;Fastcgi_buffers
.
Fastcgi_send_timeout
Syntax: fastcgi_send_timeout time
Default Value: fastcgi_send_timeout 60
Field used: HTTP, server, location
The command sets the time for the upstream server to wait for a FastCGI process to send data. If there are some FastCGI processes that have been output for a long time until they have finished running, you can modify this value, if yo
Company A test server, the recent 504 and 502 problems: ( environment lnmp,php compiled installation, fastcgi mode ), the problem is not difficult to solve, but here to share their own troubleshooting ideas and ways to deal with the problem. 504 Gateway time-out, Nginx 502
Status Code explanation502 Bad Gateway: An invalid response was received from the upstream server when the server acting as a gateway or proxy attempted to execute the request.504 Gateway time-out: When a server acting as a gateway
First, the error hint Description:
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
First, the error hint Description:
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
,sdch
accept-language:zh-cn,zh;q=0.8
accept-charset:gbk,utf-8;q=0.7,*;q=0.3
cookie:bdshare_firstime=1363517175366;
If-modified-since:mon, May 2013 13:40:02 GMT
When the request header is too large, when the large_client_header_buffer is exceeded,Nginx may return "Request URI too Large" (414) or "bad-request" (400) error.
As in the previous example, the HTTP request header is composed of multiple lines,where "get http://www.264.cn/HTTP/1.1" mea
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.