PHP thread open File handle exception caused by 502 bad Gateway

Source: Internet
Author: User
PHP thread open File handle limited error 502 bad Gateway

The resources on the Internet are basically considered to be errors caused by the limited opening of a file handle by a PHP thread. The specific solution is as follows:

?

1. Raise the file handle of the server open Open

/etc/security/limits.conf: (Increase)

* soft???????? 51200

*?????? nofile. 51200

# vi/etc/security/limits.conf? Plus
* Soft Nofile 51200
* Hard Nofile 51200

?

2, increase the number of open Nginx process file

?

Nginx.conf:worker_rlimit_nofile 51200;

?

3, modify the php-fpm.conf file, the main need to modify 2 .

?

Command Ulimit-n View the number of open files that are restricted, and the options in php-fpm.conf rlimit_files ensure that they are consistent with this value.

?

? 10240

?

51200

?

4.

# Vi/etc/sysctl. conf?
Bottom add
fs.file-max=51200

Complete the above changes, restart PHP, the warning message no longer.

?

The world is quiet, 502 bad Gateway.

  • 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.