Nginx php-fpm fast-cgi 502 Bad Gateway Error Handling

Nginx php-fpm fast-cgi 502 Bad Gateway error is FastCGI problems, resulting in the possibility of error NGINX 502 more.
Some will find on the Internet and 502 Bad Gateway error-related problems and troubleshooting methods listed about, starting with FastCGI configuration to start:
1.FastCGI whether the process has started 2.FastCGI worker process, if not by the number of command view server to open a total number of php-cgi process ps-fe | grep "php" | grep-v "grep" | wc-l
Use the following command to see how many have been used to process php-cgi processes the request tcp netstat-anop | grep "php" | grep-v "grep" | wc-l
Close to the configuration file to set the value, that the number of worker processes set too few see:
3.FastCGI execution time is too long to increase the following parameters based on actual value fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
4.FastCGI Buffer nginx and apache is not enough, as a front-end buffer limit, you can adjust the buffer parameters fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
See: E4% B8% 80% E4% BE% 8B /
5.Proxy Buffer is not enough if you use the Proxying, adjusted proxy_buffer_size 16k;
proxy_buffers 4 16k;
See also:
6.https forwarding configuration error correct configuration server_name ;
location / myproj / repos (
set $ fixed_destination $ http_destination;
if ($ http_destination ~ * ^ https (.*)$)
set $ fixed_destination http $ 1;
proxy_set_header Host $ host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header Destination $ fixed_destination;
proxy_pass http://subversion_hosts ;
See also:
7. See php-fpm.log
Error see:
8.php the bug
9.php-fpm.conf configuration see
10.nginx.conf the rewrite-url rules
I in / php / sbin / php-fpm which the php_fpm_PID = / data1/php/logs/ modified to # php_fpm_PID = / data1/php/logs/
So guess the problem is user permissions have php-fpm.conf in the estimation of the user to start the service would disappear also nginx 400 bad request error of the causes and solutions in nginx.conf in the client_header_buffer_size and large_client_header_buffers all stressed the large, may alleviate this problem.
The main configuration of which is client_header_buffer_size this one, the default is 1k, so less than 1k header, then the problem would not arise.
According to my configuration now is:
client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
This configuration can receive 16k following header, cookie in the browser the maximum number of bytes will be very big, so it is not good to use that maximum value.

分类:OS 时间:2010-03-18 人气:840
blog comments powered by Disqus


  • Ruby shell command execution method 2010-09-21

    Sometimes necessary to execute commands in the program to complete the operation, execute the command as follows: Exec $ irb >> exec 'echo "hello $HOSTNAME"' hello nate.local $ echo command with the exec method to replace the irb process to exi

  • Start the computer the 10 common troubleshooting methods 2010-07-17

    Power On Self Test after problems occur when a variety of English phrases, the phrase contains very important information, read this information can solve some small problems, but such a difficult task for some English friends, here is Some of the co

  • High Performance MySQL study notes 2010-09-09 High Performance MySQL study notes: find out who holds the lock over the weekend re-re-read "high-performance MySQL", found that some knowledge of point of views wil

  • Java Common Questions 1 2010-03-29

    What are the characteristics of object-oriented aspects of (1). Abstraction: Abstraction is to overlook a topic has nothing to do with the current target those aspects in order to more fully attention-related aspects of the current target. Abstract did no

  • GWT Introduction Introduction 2010-03-19

    GWT Introduction Introduction GWT Introduction Introduction GWT is the Google Web Toolkit short. GWT is a Java language as a tool in a similar way to write UI components Swing, followed by GWT Compiler Compiler To JavaScritp and HTML in the client browser

  • Oracle database listener configuration (very gold content of the article!) 2010-03-04

    Recently many netizens proposed monitoring configuration related issues, the customer terminal (Client) can not connect to the server side (Server). This is configured on the listener to make a brief introduction and some clients can not connect the termi

  • Oracle database listener configuration 2010-04-20

    Recently many netizens proposed monitoring configuration related issues, the customer terminal (Client) can not connect to the server side (Server). This is configured on the listener to make a brief introduction, and Tichu some customers connect to the s

  • (Transfer) linux slow to open the mysql query, analysis of a query, why does this query to open? 2010-08-18

    Open the mysql slow query under linux, analysis of a query, why do want to open this query? The database is prone to bottlenecks where discussion now Nosql so hot, it is estimated have been depressed out of the database. mysql speed most affected are

  • (R) linux mysql open under the slow query, analysis, query one, why should open this query? 2010-08-18

    Open the mysql slow query under linux, analysis, query one, why should open this query? Database is very easy to create a bottleneck where now Nosql discussion so hot, it is estimated to engage in the database have been depressed. mysql speed is the

  • Structs of validator validation framework 2010-06-04

    Verification Framework Validator Struts framework can ActionForm Bean's validate () method on the user input form data validation. This authentication method has two limitations:  be achieved through code validation logic, if the validation logic cha

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.310 (s). 14 q(s)