Can't raise nginx max files opened limit

Solution 1:

The config /etc/security/limits.conf is specific to PAM. PAM, in general, is not used by software that manages services such as nginx.

So everything from init, to upstart, to systemd do not use the limits.conf at all.

nginx has a specific configuration setting for increasing the file descriptor limit worker_rlimit_nofile.

Outside of all configuration blocks (not in http or a server) add:

worker_rlimit_nofile 10240