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
相关推荐
yserver 2020-08-15
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10