PHP-FPM high load causes 502 Bad Gateway Error resolution

Source: Internet
Author: User
Tags fpm php script

The way to resolve 502 Bad Gateway is:

1. Depending on the performance of the server, in the php-fmp.conf to increase the value of Max_children, I currently use 15.

(a php-fpm uses about 20M of RAM, if your memory is about 1G,1024/20=50)

2. Use the reload parameter to reload the PHP-FPM periodically. Release the memory used by PHP-FPM, the PHP script execution time is too long to cause memory to use excessively, overload php-fpm can eliminate this problem. How to completely resolve the php-cgi script takes up a lot of memory and results in a 502 error. It is worth exploring further, and this is a good way to do so.

The practice is to use crontab to let php-fpm smooth restart, so that the PHP script does not affect the operation.

*/30 * * * */usr/local/php/etc/php-fpm.conf Reload

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.