Notifications
Clear all

[Solved] How to find ulimit (Max Open FIles Limit) for Nginx on Ubuntu

1 Posts
1 Users
0 Reactions
10 Views
Tharindu
(@tharindu)
Reputable Member Admin
Joined: 10 years ago
Posts: 309
Topic starter  

Finding ulimit (Max open files) for nginx user is important when optimizing nginx configuration. Specially when setting worker_rlimit_nofile directive and worker_connections directive. The simple commands to check this limits are as follows.

ulimit -Hn
ulimit -Sn

These commands only work if you can login to the user account. If you execute these commands as root user, you get the values for root user. And to find the limits for nginx user, you need to be logged in to that account (www-data or nginx). But the problem is, we can't login to nginx user account. Because it has the nologin shell. Instead of trying to change the shell for www-data (or nginx), you can use following method to check the ulimit for www-data.

Get the PID for www-data,

ps -u www-data

Note the PID value for nginx. And then execute following command with term PID replaced with actual PID,

grep 'open files' /proc/PID/limits

It'll return max open file limit for nginx.


   
Quote
Share:
Back to top button