发布网友
共1个回答
热心网友
设置 nginx 和 php-fpm 的 Max open files 数量方法如下:
一、、由于使用 setuid 方式并不会通过 PAM ,所以 nginx 提供了 worker_rlimit_nofile 选项来自己定制 worker 的 Max open files 数量,比如,在 nginx.conf 中添加全局参数:worker_rlimit_nofile 65535;
二、、同样的,php-fpm 也有类似的参数 rlimit_files 只需要在 /etc/php5/fpm/php-fpm.conf 文件中添加该参数:
INI
rlimit_files = 65535
即可设置 nginx 和 php-fpm 的 Max open files 数量。
三、、以下为一些扩展信息:
1、在 limits.conf 的 man 页面就说明:
limits.conf – configuration file for the pam_limits mole
2、同时,在 pam_limits 的 man 页面也说明:
The pam_limits PAM mole sets limits on the system resources that can be obtained in a user-session
……
The mole must not be called by a multithreaded application.
3、至此,/etc/security/limits.conf 不能设定守护进程的 Max open files 数量已经显而易见了。