nginx accept() failed (24: Too many open files)

nginx服務器出現以下信息:
[crit] 17221#0: accept4() failed (24: Too many open files)
[crit] 17221#0: accept4() failed (24: Too many open files)
[crit] 17221#0: accept4() failed (24: Too many open files)
[crit] 17221#0: accept4() failed (24: Too many open files)
[crit] 17221#0: accept4() failed (24: Too many open files)
原回是nginx進程打開文件數過多
 
解決方法:
修改/etc/security/limits.conf文件
* soft nofile 10240
* hard nofile 10240
星號表明全局,soft爲軟件,hard爲硬件,nofile爲這裏指可打開文件數。
root soft nofile 10240
root hard nofile 10240
nobody soft nofile 10240
nobody hard nofile 10240
修改nginx.conf,添加以下代碼:
worker_rlimit_nofile 10240;
重啓nginx服務器。
相關文章
相關標籤/搜索