Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/51425325
There is a very high number of server access, using Nginx, the error log keeps reporting the following error:
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
2016/05/16 08:53:49 [alert] 13576#0:accept () failed (24:too many open files)
Workaround:
Ulimit-n in centos5.3 is 1024, when the number of nginx connections exceeds 1024, the following error occurs in Error.log:
[Alert] 12766#0:accept () failed (24:too many open files)
Use Ulimit-n 655350 to set the number of open files large enough, while modifying nginx.conf, add Worker_rlimit_nofile 655350; (same level as Error_log)
This will solve the problem of too many nginx connections, nginx can support high concurrency. < also modify Nginx>
In addition, Ulimit-n also affects the number of concurrent connections to MySQL. Raise him up, and it will improve MySQL concurrency.
Note: The ulimit-n 2048 modification is valid only for the current shell, and fails after exiting.
Modify method
To make the value of the modified Ulimits permanent, you must modify the configuration document, you can put the Ulimit Modify command into the/etc/profile inside, this method is really inconvenient,
One more way is to modify /etc/security/limits.conf
/etc/security/limits.conf format, the file contains very detailed comments, such as
* Soft Nofile 655360
* Hard Nofile 655360
The asterisk represents the global, soft is software, hard is hardware, nofile refers to the number of open files here.
Add the above two lines of content to the limits.conf file.
Also, to make the limits.conf file configuration effective, you must make sure that the pam_limits.so file is added to the startup file. The view/etc/pam.d/login file has:
Session required/lib/security/pam_limits.so
You can see the effect by logging in again, and you can see it through ulimit-n.
The above describes the Nginx--nginx:accept failed 24:too Many open files, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.