Nginx + php-fpm error 502 bad gateway solution, nginxphp-fpm
1. nginx error cannot be found. Generally, You need to modify/usr/local/nginx/conf/nginx. conf (careful modification may cause other website problems)
Error 2,502
Case 1: nginx
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
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
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
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
Nginx 502 Bad Gateway can be forcibly refreshed by the client, but the solution is either to change the configuration or put it on the CDN. In this case, someone found that index.html can be accessed. Because we are an online website and do not have much time to study it, this is temporary. Then, someone suggested that Ctrl + F5 should be used to refresh the cach
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 sud
, find a balance point.
There's also a lazy approach to max_children,
If your PHP is 5.3, then you can set the FPM style to Apache-like, this time the number of children by FPM automatic control. The corresponding configuration parameters are
Start_servers: Number of start processes
Min_spare_servers: Minimum number of processes
Max_spare_servers: Maximum number of processes
When the server is more idle, FPM will take the initiative to kill some redun
[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
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 processesMin_spare_servers: Minimum number of processesMax_spare_servers: Maximum number of processesWhen the server is idle, fpm will take the initia
debug, find a balance point.
There's also a lazy approach to max_children,
If your PHP is 5.3, then you can set the FPM style to Apache-like, at which time the number of children is automatically controlled by FPM. The corresponding configuration parameters are
Start_servers: Number of start processes
Min_spare_servers: Minimum number of processes
Max_spare_servers: Maximum number of processes
When the server is idle, FPM will actively kill some extr
error occurs. You can increase memory_limit of php. ini to 64 MB.Other causes that may cause 502 bad gateway errorsInsufficient. php-fpm process countUse netstat-napo | grep "php-fpm" | wc-l to check the number of fastcgi processes. If the number is close to the upper limit configured in conf, you need to increase the number of processes.However, you cannot increase the number of php-fpm sub-processes to 100 or more based on the server memo
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 compiled and installed successfully.
Solutio
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 ti
;
Location/{
root html;
Index index.html index.htm;
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root html;
}
}} [Root@ansheng conf]# egrep-v "#|^$" Nginx.conf.default nginx.conf
Iv. Add the following tags and contents to the Server tab of the Nginx configuration file
location/logs {
alias/application/nginx-1.9.7/logs;
When to use
Used to set the request resources and the server return time, to ensure that a request to occupy a fixed time, beyond the 504 timeout! This will ensure that a request takes too long.
Second, the main parameters
Use the Nginx server if you encounter timeou conditions, you can set the following parameters
Friends using the Nginx server may be aware of the need to set the HTML static page cache with page compression and expiration time settings, I would like to introduce to you the configuration method, including the Ico,gif,bmp,jpg,jpeg,swf,js,css, MP3 files are cached locally.
The server's bandwidth overhead can be reduced by nginx the static resources on the se
In doing automatic static, suddenly think of the following scenario, also gives the solution. Pro, really very practical, patience to look down.
When I upload a screenshot from the background, after the screenshot of 480*800, there is no small thumbnail of 320*480. OK, the server polls, all produce a 320*480 picture.
The next time, there are 160*240 pictures, and polling it, time-consuming and laborious,
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.