nginx 修改 max open files limits
注意:修改 nginx 的 max open files 有个前提,就是你已经修改好了系统的 max open files.
先查看 nginx 的 ulimits: grep 'open files' /proc/$( cat /var/run/nginx.pid )/limits
修改 nginx.service
sudo vi /lib/systemd/system/nginx.service # (仅适用于 ubuntu)添加:
[Service]
LimitNOFILE=100000重启服务:
sudo systemctl daemon-reload修改 nginx.conf,
添加:
worker_rlimit_nofile 90000; # (has to be smaller or equal to LimitNOFILE set above)重启 nginx:
sudo systemctl restart nginx上面是网上流传的教程,但是还是不够,你这样改了之后,nginx 的并发能力反而会下降,所以还需要改一个关键的参数:
修改 nginx.conf
添加:
events {
worker_connections 90000;
}重启 nginx:
sudo systemctl restart nginx本文内容仅供个人学习/研究/参考使用,不构成任何决策建议或专业指导。分享/转载时请标明原文来源,同时请勿将内容用于商业售卖、虚假宣传等非学习用途哦~感谢您的理解与支持!