/etc/security/limits.conf
is read by the PAM module pam_limits.so
at login.
But when nginx is started at boot, it never passes through a login procedure, so PAM never has a chance to make any ulimit changes to the nginx process or any of its parent processes.
If your nginx
is started by a script, then you should add the ulimit commands to the script:
ulimit -H -n 60000
ulimit -S -n 60000
If nginx
is started by a systemd
.service file, use systemctl edit nginx.service
, and add this line to the [Service]
section of the file:
LimitNOFILE=60000:60000
systemctl edit some.service
will automatically take the original service file from [/usr]/lib/systemd
tree and place the modified version under /etc/systemd
instead. Any files in /etc/systemd
will override any files with the same name located in [/usr]/lib/systemd
tree.
It will also cause the service configuration to be automatically reloaded, so you don't need to use systemctl daemon-reload
manually.