I had a similar problem when trying to increase the number of file descriptors for Nginx. I had to change nofilein /etc/security/limits.conf for the www-data user:
www-data hard nofile 16384
www-data soft nofile 16384
After this change, ulimit still showed a limit of 1024. The solution was to include * pam_limits * in /etc/pam.d/su. I just uncommented the line:
session required pam_limits.so
, www-data. ulimit -a 16384.
, .