This solutions is application to cpnginx and danginx plugins and bare nginx server configurations.
Edit the file /etc/sysctl.conf and increase the openfile limits. Add the following line,
fs.file-max = 700000
Edit /etc/security/limits.conf and add the following lines,
nobody soft nofile 100000
nobody hard nofile 500000
Now apply the sysctl configuration using the following command .
# sysctl -p
Now edit the /usr/local/nginx/conf/nginx.conf file and add the following line.
Now stop nginx server and restart.