Nginx – How to check nginx open file limit on Ubuntu Server

nginxUbuntu

I want to su - nginx so I can check if I have set up soft and hard limit for opened files correctly.

Why can't I su - nginx? I get an error *No passwd entry for user 'nginx'*


EDIT:

Of course the user was www-data not nginx…
When I do su - www-data I get This account is currently not available.

Basically what my question is, I want to see limits for opened files. If I do ulimit -n under root, I get 1024, which I know is wrong…

Best Answer

You have something of a misunderstanding. On most Linux systems, PAM sets resource limits when users log in as configured. But nginx never logs in. So you're measuring something that has nothing to do with anything -- nobody ever logs in as the www-data process, you weren't even able to do it, so whatever file limit that process creates wouldn't be one that affected anything.

The nginx process is started by some other process and inherits that process' resource limits. The launch script may or may not change them, and the nginx process itself may or may not change them. You can investigate this if you want, but not by logging in as the www-data user.

Related Topic