前言
略
php-fpm 资源耗尽
php-fpm 的子进程耗尽的时:
- 会导致 502 出现
- nginx 出现错误日志
2024/07/18 20:19:10 [crit] 36390#0: *1402471 connect() to unix:/tmp/php-cgi-81.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.162, server: xxx, request: "POST /api.html HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi-81.sock:", host: "xxx", referrer: "https://xxx/"
如何解决
合理配置max_children参数。
宝塔推荐值:
- 8G内存时,pm.max_children = 120
- 16G内存时,pm.max_children = 200
- 32G内存时,pm.max_children = 300
使用宝塔设置
参考
https://blog.csdn.net/solmyr_biti/article/details/53955141
https://www.jb51.net/article/157900.htm
https://blog.csdn.net/weixin_33701251/article/details/92332376