Ubuntu Nginx PHP-FPM Newspaper 502 Bad Gateway error

Source: Internet
Author: User
Tags fpm

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/Linux/2015-07/119754.htm

Analysis 502 Bad Gateway error, not nginx this side, should be the PHP resolution to deal with the problem there, it is estimated that php5-fpm problems, can not handle PHP parsing. So to do the corresponding optimization, to prevent the next occurrence of such problems

high-profile Linux kernel open file numberYou can use these commands (must be root account) echo ' ulimit-hsn 65536 ' >>/etc/profile echo ' ulimit-hsn 65536 ' >>/etc/rc.local source /etc/profile
script Execution time timed outIf the script does not return for a long time because of some reason, the new request cannot be processed, and the following configuration can be adjusted appropriately. Fastcgi_connect_timeout 300; Fastcgi_send_timeout 300; Fastcgi_read_timeout 300; php-fpm.conf if the following request_terminate_timeout = 10s
Increase the number of php5-fpm  processes https://www.cnblogs.com/52fhy/p/5051722.html pm = dynamic                                                                                                                                                                  pm.max_children = 64                                                                                                                                                       pm.start_servers = 32                                                                                                                                                      pm.min_spare_servers = 16                                                                                                                                                   pm.max_spare_servers  = 32 pm.max_requests = 5000 pm =  Dynamic   How to control the subprocess, the options are static and dynamic Pm.max_ Children: The number of PHP-FPM processes that are open in a static way pm.max_requests:php-fpm the maximum number of requests that a subprocess can handle pm.start_servers: The number of start PHP-FPM processes under dynamic mode Pm.min_ Spare_servers: The minimum number of php-fpm processes in a dynamic way pm.max_spare_servers: The maximum number of PHP-FPM processes under dynamic mode: If the DM is set to  static, then there is only pm.max_ Children this parameter takes effect. SystemThe set number of PHP-FPM processes is turned on. If the DM is set to  dynamic, then the Pm.max_children parameter fails and the following 3 parameters take effect. The system starts the Pm.start_servers PHP-FPM process at the start of the PHP-FPM run  , and then dynamically pm.min_spare_servers and pm.max_spare_servers according to the requirements of the system Adjusts the number of php-fpm processes between.


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.