centos 7, setting nofile and nproc on systemd

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

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *