LNMP common 502 Bad Gateway Problems
When we configure LNMP, we always encounter 502 problems. Whether it is in the browser or using the curl command, it is easy to see "502 Bad Gateway ", so what is the cause of the error and how to solve it. I have summarized it based on my experience.
Error 1: configuration error
Le
/wwwroot/jifen.51.com/www/index.php'(Request:"Get/center/index") Execution timed out(31.055392sec), terminating[ in-dec- . ,: -: One] WARNING: [Pool www] Child9978, script'/opt/wwwroot/jifen.51.com/www/index.php'(Request:"Get/center/index") Execution timed out(30.037908SEC), terminatingOpen the php-fpm.conf configuration file, set the Request_terminate_timeout = 30 set of a single script execution more than 30s will be terminated.And in the php.ini config file Max_execution_time = 60, set a sin
PHP program appears 502 bad gateway how to break?
Reply content:
PHP program appears 502 bad gateway how to break?
Confirm that the PHP-FPM process is healthy, and then start with the run environment and adjust the timeout and buffer size configurations.
For example a iptables + haproxy + nginx + PHP-FPM operati
Millions of data were checked directly Nginx 502 bad gateway. Another server is good. I cannot log on to the server to view the configuration. Ask you to get nginx+php comrades. What are the settings of your server? I sent it to the hardware department.
Reply to discussion (solution)
502 is usually the php-fpm of the meal. This may be due to an excessive number of FPM connections or a longer program
continuously debug and find a balance point based on the running status of your website.
There is also a lazy approach for max_children,
If your php is 5.3You can set the fpm style to apache-like. In this case, the number of children is automatically controlled by fpm. The corresponding configuration parameters are:
Start_servers: Number of starting processes
Min_spare_servers: Minimum number of processes
Max_spare_servers: Maximum number of processes
When the server is idle, fpm will take the
processes" is close to the preset "fastcgi process", then the "fastcgi process count" is not sufficient and needs to be increased. But be careful to calculate whether your memory is enough to support more processes, if the physical machine memory is not large enough, it is useless to increase the number of processes.2, some of the PHP program execution time than the Nginx wait time, you can appropriately increase the nginx.conf configuration file fastcgi timeout time, as follows:http{......Fast
On the Saturday game not to go, their own tools to test, the hint 502 bad gateway error, not know how the whole, unexpectedly put the server restarted, and so the boss of the verification code, tossing the majority of days, in fact, not so, direct birth php5-fpm, and Nginx can
/ETC/INIT.D/PHP5-FPM restart
Service Nginx Restart
If reboot fails
If prompted fail sudo nginx-t view reason http://www.linuxidc.com
The first reason for the nginx 502 Bad Gateway error of the one-click lnmp installation package is that the lnmp one-click installation package has many problems: 502 Bad Gateway. In most cases, the reason is that before installing PHP, some lib packages in the script may not be installed, resulting in PHP not being co
A large number of queries often appear 502 bad Gateway
Millions of data were checked directly Nginx 502 bad gateway. Another server is good. I cannot log on to the server to view the configuration. Ask you to get nginx+php comrades. What are the settings of your server? I sent it to the hardware department.
------Solut
parameter will not work. The real ability to control the maximum execution time for PHP scripts is the following parameters in the php-fpm.conf configuration file:Attention! The format of the new PHP-FPM in the configuration file is:request_terminate_timeout=0sThe default value is 0 seconds, which means that the PHP script will continue to execute. This way, when all the php-cgi processes are stuck in the file_get_contents () function, the nginx+php WebServer can no longer process the new PHP r
LNMP upgrade php5.4.28 or later version error 502 bad Gateway
Encounter a very strange problem, with LNMP./upgrade_php.sh upgrade php5.4.27 normal.
But upgrade to php5.4.28 error, Access p.php hint: Nginx 502 bad Gateway. Try again in the morning, upgrade to 5.5.12 access p.php is also the same hint: Nginx 502
Output Log configuration:http://blog.csdn.net/wzy_1988/article/details/8486888Solution:Http://www.cnblogs.com/jackluo/p/3366612.htmlAbout the 502 solution caused by file_get_contents:Http://www.111cn.net/phper/php-function/55873.htmHttp://www.qetee.com/share/php-fpm-cpu100.htmlReplace the system's own file_get_contents with the file_get_content function of your own package= stream_context_create (Array ( 'http' = = Array (' Timeout'// set a time-out, in seconds ) );
Nginx can receive 80 requests, but cannot go to tomcat:8080.
Direct access to Http://x.x.x.x:8080/project can be accessed
View/var/log/nginx/error.log
2015/04/01 11:38:13 [crit] 2895#0: *10 connect () to 127.0.0.1:8080 failed (13:permission denied) while connecting to Upstream, client:10.12.70.206, server:localhost:8080, Request: "GET/BPP http/1.1", Upstream: "http://127.0.0.1:8080/ App ", Host:" 10.11.202.204 "
Solution:
Http://stackoverflow.com/questions/25235453/nginx-proxy-server-localhost-
[ArticleAuthor: Zhang banquet this article version: V1.0 last modified: 2008.07.30 reprint please indicate the original article link: http://blog.s135.com/read.php/361/]
Yesterday, a friend asked me how to solve the "502 Bad Gateway" error when he changed the Web server to nginx 0.6.31 + PhP 4.4.7 (FastCGI.
I will follow the two steps below to solve the problem, and finally increase the timeout time of Fa
To find some of the Internet and 502 bad gateway errors related to the problems and troubleshooting methods, first from the fastcgi configuration start:
1. See if the fastcgi process has started
The meaning of the NGINX 502 error is sock, the port is not being monitored. Let's check to see if fastcgi is running.
2. Check system fastcgi Process operation
In addition to the first case, the fastcgi process
Php-cgi supported by php-fpmModify the php-fpm process count in/usr/local/php/etc/php-fpm.conf to find max_children and change the following value to the value you want to set.. The code is as follows:Copy code # Vim/usr/local/php/etc/php-fpm.conf # Max_children indicates the processing process of php-cgi. Setting max_children also needs to be set based on the server performance, increasing the number of processes and occupying memory.It will also increase accordingly. Under normal circumst
occur during installation and use. Generally, the default PHP-CGI process is five, which may be caused by insufficient phpcgi processes, you need to modify/usr/local/PHP/etc/php-fpm.conf to add the max_children value as appropriate. It is also possible that the max_requests value is insufficient. It must be noted that this configuration item occupies a large amount of memory. Please set it according to the server configuration. Otherwise, it may have a negative effect.
Iv. PHP Execution timeout
# in Nginx and PHP-FPM next visit Nginx on the instant 502 question Php-fpmsignal 7 (Sigbus)
Failure phenomenon
Use the tinkphp3.2.x frame, the page occasionally appear a visit Nginx on the report 502 bad Gateway, not wait for a period of time Nginx only reported 502, open the page of the moment on 502.
PHP-FPM Log
[28-sep-2015 23:25:07] WARNING: [Pool www] child 2965 exited on Signal 7 (Sigbus) after
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.