May 232016
 

this is how to set maximum number of open file and maximum number of processess on systemd startup script. for example you want give nginx process nofile 20000 and nproc unlimited.

edit nginx.service file

#vi /etc/systemd/system/multi-user.target.wants/nginx.service

add these into [Service] section

LimitNOFILE=20000
LimitNPROC=infinity

reload the systemd script daemon

#systemctl daemon-reload

finally, restart nginx service, and you’re done.

#systemctl restart nginx.service