Nginx文件描述符限制 [英] Nginx File descriptor limit
问题描述
如何增加nginx中的文件描述符限制?
How can I increase the file descriptors limit in nginx?
有几种增加文件描述符的方法:
There are several ways to increase file descriptors:
-
编辑
/etc/security/limits.conf
并为nginx用户设置nofile软限制和硬限制.
Edit
/etc/security/limits.conf
and set nofile soft and hard limits for the nginx user.
在/etc/default/nginx
中设置$ ULIMIT. Nginx init.d
脚本设置了ulimit $ ULIMIT https://gist.github. com/aganov/1121022#file-nginx-L43
Set $ULIMIT in /etc/default/nginx
. The nginx init.d
script set ulimit $ULIMIT https://gist.github.com/aganov/1121022#file-nginx-L43
在nginx.conf
中设置worker_rlimit_nofile
http://wiki.nginx.org/NginxHttpMainModule#worker_rlimit_nofile
在启动时使用init.d
脚本启动时,limits.conf
中的设置限制是否会影响nginx?
Does setting limits in limits.conf
affect nginx when started using init.d
script on boot?
我是否必须在初始化脚本中使用ulimit $ ULIMIT还是可以使用worker_rlimit_nofile
代替?
Do I have to use ulimit $ULIMIT in the init script or can worker_rlimit_nofile
be used instead?
在初始化脚本中使用ulimit $ ULIMIT时,我仍然需要使用worker_rlimit_nofile
为每个工作程序设置限制吗?
When using ulimit $ULIMIT in the init script, do I still need to use worker_rlimit_nofile
to set limits for each worker?
谢谢
推荐答案
增加限制的正确方法是设置worker_rlimit_nofile.
The correct way to increase the limit is by setting worker_rlimit_nofile.
这篇关于Nginx文件描述符限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!