Nginx: 24: Too Many Open Files Error And Solution

Nginx: 24: Too Many Open Files Error And Solution

The "24: Too many open files" error in Nginx can occur when the number of file descriptors (FDs) that Nginx is trying to open exceeds the maximum number of FDs allowed by the operating system.

There are a few possible solutions to this problem:

  1. Increase the number of FDs allowed by the operating system: You can increase the maximum number of FDs allowed by the operating system by modifying the ulimit value. To do this, you can run the following command:
refer to:‮uttual‬ri.com
ulimit -n 65535

This will increase the maximum number of FDs allowed to 65535. You can adjust this value to a higher or lower value depending on your needs.

  1. Increase the number of FDs allowed by Nginx: You can also increase the maximum number of FDs allowed by Nginx by modifying the worker_rlimit_nofile directive in the Nginx configuration file. For example:
worker_rlimit_nofile 65535;

This will increase the maximum number of FDs allowed to 65535. You can adjust this value to a higher or lower value depending on your needs.

  1. Tune the Nginx worker process settings: If you are still experiencing the "24: Too many open files" error after increasing the number of FDs allowed by the operating system and Nginx, you may want to try tuning the Nginx worker process settings. This may involve adjusting the values of the worker_processes, worker_connections, and multi_accept directives in the Nginx configuration file.

  2. Check for leaks: If you are experiencing the "24: Too many open files" error frequently, it may be a sign the upper limit has been hit, and the process is not being permitted to open any more files.

Created Time:2017-10-30 10:17:52  Author:lautturi