nginxでabした時にtoo many open filesになってしまった場合の対処
cd /etc/nginx/
cp -p nginx.conf nginx.conf.date +%Y%m%d
vi nginx.conf
— 追記 worker_rlimit_nofile 8192; <–ここ
events { worker_connections 1024; }
service nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
service nginx resrart
ps aux | grep nginx
root 13282 0.0 0.0 44752 1172 ? Ss 18:58 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 13283 0.0 0.0 45204 1876 ? S 18:58 0:00 nginx: worker process nginx 13284 0.0 0.0 45204 1812 ? S 18:58 0:00 nginx: worker process nginx 13285 0.0 0.0 45204 1876 ? S 18:58 0:00 nginx: worker process nginx 13287 0.0 0.0 45204 1860 ? S 18:58 0:00 nginx: worker process
cat /proc/13287/limits
Max open files 8192 8192 files <– worker_rlimit_nofileで記述した値が上書きされていることがわかる。 参考URL:http://www.1x1.jp/blog/2013/02/nginx_too_many_open_files_error.html