Solve the 502 Bad Gateway error encountered by nginx + PhP (FastCGI) [original]

Source: Internet
Author: User

[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 FastCGI to 2nd in step 1. Solve the problem:

PS: I envy Thunder's web server, with 16 GB of memory.

1. Check whether the current PHP FastCGI process count is sufficient:

Netstat-anpo | grep "PHP-cgi" | WC-l

If the number of FastCGI processes actually used is close to the preset number of FastCGI processes, it indicates that the number of FastCGI processes is insufficient and needs to be increased.

2. Some PHPProgramThe execution time of nginx exceeds the waiting time of nginx. You can add the timeout time of FastCGI in the nginx. conf configuration file, for example:

......
HTTP
{
......
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
......
}
......

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.