Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
NGINX Technical Guide

NGINX Connection Limit: worker_connections and Open File Settings

If NGINX is unable to accept new connections at high traffic, and you see "worker_connections are not enough" or "too many open files", only increase one number at a time. The worker count, file descriptor limit, proxy connections, keepalive, WebSocket, and bot traffic should be measured together.

worker_connectionsToo Many Open FilesLimitNOFILEKeepaliveHigh Traffic
root@server:~SSH
2026/07/17 04:27:03 [alert] 2511#2511: 1024 worker_connections are not enough
2026/07/17 04:27:04 [crit] 2511#2511: accept4() failed (24: Too many open files)
Request flowClient, NGINX, and backend connection break point
ConfigurationValidation of active server and location blocks
Live diagnosisLog, socket, port, and service controls
Secure ApplicationTest, controlled reload and result verification
01
Technical description

What does worker_connections and open file limit determine?

The simultaneous connection limit for each NGINX worker is determined by worker_connections. Reverse proxy connections, upstream sockets, and some open files also consume descriptors; the theoretical capacity cannot exceed the operating system limit.

worker_processes should be set to auto on most systems as it creates workers based on CPU; although it may seem like total client capacity is simply worker_processes × worker_connections, in proxy usage, an additional upstream connection may be required for each client.

worker_rlimit_nofile can increase the open file limit of NGINX workers, but it should be consistent with systemd LimitNOFILE and process soft/hard limits.

Long keepalive, WebSocket or SSE connections can keep many connections open even in low request traffic. stub_status, ss and /proc process limits should be monitored together.

Do not increase the limit alone without investigating if the sudden limit warning is caused by a bot/DDoS, slow client, upstream connection leak, or incorrect keepalive configuration.

When using a proxy client in the capacity account, consider that both client and upstream connections are consumed; the real value should be measured with stub_status and process fd number.

02
Log messages and their meanings

Worker, file descriptor, and connection limit messages

Search for the phrase you see in the email, browser, or SSH log. Each card includes meaning, probable cause, and safe initial action.

8 registration
01kritik

worker_connections are not enough

Meaning: A worker has reached the defined limit for new connections.

Possible cause: Low limit, long links or traffic surge.

Measure active connections, worker count, and limits together.
02kritik

accept4() failed (24: Too many open files)

Meaning: The process cannot open a new socket/file descriptor.

Possible cause: The NOFILE soft/hard or systemd limit is too low.

Check NGINX master/worker /proc limits and fd count.
03kritik

socket() failed (24: Too many open files)

Meaning: Failed to create upstream or client socket.

Possible cause: Descriptor limit or leak.

Monitor lsof and /proc/PID/fd.
04warning

open socket left in connection

Meaning: A socket remained open during reload.

Possible cause: Long connection or module behavior.

Examine WebSocket/stream connections and worker shutdown time.
05warning

connect() failed (99: Cannot assign requested address)

Meaning: The local ephemeral port or network resource may have been exhausted.

Possible cause: Too many upstream connections or TIME_WAIT.

Examine ss -s and ip_local_port_range value.
06warning

upstream timed out under load

Meaning: Connection limit is not filled directly but the worker/backend queue is growing.

Possible cause: Upstream capacity is lower than NGINX.

Sync NGINX with backend concurrency limits.
07bilgi

1024 worker_connections

Meaning: Common default/example value may be insufficient for a heavy system.

Possible cause: No capacity planning for config.

Calculate based on real traffic and fd limits.
08bilgi

EMFILE: too many open files

Meaning: The application or NGINX process has reached the file descriptor limit.

Possible cause: Limit or file/socket leak.

Determine which process's fd count is increasing.

No records matching this expression were found.

03
Secure first review

SSH diagnostic commands and what output to look for?

Commands are for root access. Collect only status and logs first; Do not change the permanent setting without seeing the reason.

Worker and connection settings
nginx -T | grep -nE 'worker_processes|worker_connections|worker_rlimit_nofile|keepalive_timeout|keepalive_requests'

Displays active capacity and connection lifetime settings.

Process limitleri
MASTER=$(cat /run/nginx.pid); cat /proc/$MASTER/limits | grep -i 'open files'
for p in $(pgrep -f 'nginx: worker'); do echo PID=$p FD=$(ls /proc/$p/fd | wc -l); cat /proc/$p/limits | grep -i 'open files'; done

Master and worker show real NOFILE limits/fd usage.

Connection summary
ss -s
ss -ant state established | wc -l
ss -ant state time-wait | wc -l

Measures active, established, and TIME_WAIT connections.

Stub status
curl -s http://127.0.0.1/nginx_status

Shows Active, accepts, handled, requests, reading/writing/waiting values.

systemd NOFILE
systemctl show nginx -p LimitNOFILE
systemctl cat nginx

Shows the open file limit in service unit and override files.

Reload and limit validation
nginx -t && systemctl reload nginx
systemctl show nginx -p LimitNOFILE

Apply config change and validate service limit.

04
By hosting environment

Ubuntu/Debian, AlmaLinux/CloudLinux and Plesk controls

Although the root cause of the NGINX error is the same, package paths, service names, security layers and virtual host management vary depending on the Linux distribution or Plesk infrastructure used.

Ubuntu / Debian

NGINX Worker Connections and Open Files for systemd, package path and journald controls.

  • First, verify the active NGINX configuration and service status.
  • Compare the domain error log with the systemd log in the same time range.
  • Run nginx -t before the change, then perform a graceful reload.
nginx -T | grep -nE 'worker_processes|worker_connections|worker_rlimit_nofile' systemctl show nginx -p LimitNOFILE ss -s

AlmaLinux / CloudLinux

NGINX Worker Connections and Open Files for SELinux, PHP-FPM pool and RHEL-based service controls.

  • Check the active status of NGINX and related backend services.
  • Review SELinux AVC records and security contexts.
  • Do not restart the service without passing the configuration test.
nginx -T | grep -nE 'worker_processes|worker_connections|worker_rlimit_nofile' systemctl show nginx -p LimitNOFILE ss -s

Plesk Obsidian

NGINX virtual host files generated by Plesk: control nginx worker connections and open files.

  • Review the additional directives in the Domains > Apache & nginx Settings section.
  • Separate manually created and Plesk generated files.
  • If necessary, recreate the web configuration for the relevant domain only.
nginx -T | grep -nE 'worker_processes|worker_connections|worker_rlimit_nofile' systemctl show nginx -p LimitNOFILE plesk repair web -n
05
Safe solution order

NGINX worker_connections and open files solution sequence

First, measure the actual connection/fd usage and traffic type; then adjust the NGINX, systemd, and operating system limits to be compatible.

1

Record the time and traffic profile of the error.

Determine whether it's bot traffic, normal growth, or WebSocket/keepalive

date; uptime; ss -s
2

Extract active worker settings.

Record worker count, connection limit, and rlimit values

nginx -T | grep -nE 'worker_processes|worker_connections|worker_rlimit_nofile'
3

Measure real process NOFILE and fd usage.

Compare config value with /proc limits and open descriptor count.

for p in $(pgrep -f 'nginx: worker'); do echo -n "$p "; ls /proc/$p/fd | wc -l; done
4

Analyze connection types

Separate established, waiting, TIME_WAIT, WebSocket and upstream connections.

ss -ant | awk 'NR>1 {s[$1]++} END {for(k in s) print k,s[k]}'
5

Implement compatible limits and traffic control.

worker_connections, worker_rlimit_nofile and systemd LimitNOFILE should be planned together.

systemctl show nginx -p LimitNOFILE
6

Watch and verify under load

After reload, follow the fd number, stub_status, and error_log warnings.

nginx -t && systemctl reload nginx watch -n2 'ss -s; curl -s http://127.0.0.1/nginx_status'
06
Distinction by symptom

Special scenarios and decision trees

Sudden bot/DDoS traffic

If the limit increase has been made, IP/URI distribution and rate limiting plan are required.

awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head
WebSocket connections

Long-running connections consume worker capacity.

ss -antp | grep nginx | wc -l
Uzun keepalive

Waiting connections and the keepalive_timeout value are examined.

curl -s http://127.0.0.1/nginx_status; nginx -T | grep keepalive_timeout
Reverse proxy load

Consider additional upstream sockets for each client.

ss -antp | grep nginx | head
Log/file descriptor leak

If a worker's fd count is constantly increasing, open targets are examined.

lsof -p $(pgrep -f 'nginx: worker' | head -1) | head -n 50
Plesk multi-domain server

Global nginx.conf, web server template and domain traffic are evaluated together.

nginx -T | grep worker_connections; ss -s

Absolutely don't

  • Do not increase worker_connections without checking systemd/NOFILE limit.
  • Do not only counter DDoS or bot traffic by increasing capacity.
  • Too high keepalive and unlimited WebSocket connections, do not leave without measuring.
  • Do not overlook the possibility of a file descriptor leak.
  • Do not assume that an ulimit change is only applied in the shell profile and to the systemd service.

Post-solution verification

  • The worker process open file limit is the planned value.
  • The number of active file descriptors is below the safe limit.
  • The error log does not produce a new worker_connections/too many open files record.
  • stub_status accepts and handled values between there is no loss.
  • Bot/rate limit and upstream capacity is compatible with normal traffic.
07
Official technical resources

Official documentation of NGINX and related components

08
Internal SEO content set

Related NGINX error solutions

09
Frequently asked questions

NGINX Worker Connections and Open Files Curiosities about

What does worker_connections determine?

Sets the upper limit for the number of connections each worker process can open at the same time; proxy upstream connections are also included in this number

How is total connection capacity calculated?

Worker processes and worker connections are considered roughly, but the file descriptor limit, proxy connections, and traffic type reduce the actual capacity.

How to solve Too many open files?

Process NOFILE, systemd LimitNOFILE, worker_rlimit_nofile, and actual fd usage must be compatible with each other.

Is increasing worker_connections sufficient?

No. It will be ineffective if the operating system limit is low; it can exacerbate the problem if there is bot traffic or fd leak.

What does stub_status show?

Active connections, accepts, handled, requests showing the number of reading/writing/waiting connections.

Does it affect the NGINX WebSocket limit?

Yes. Every open WebSocket client for a long time and mostly consumes upstream connection.

How is systemd LimitNOFILE verified?

systemctl show nginx -p LimitNOFILE and check the /proc/PID/limits file of the running worker together.

EKA SOFTWARE AND INFORMATION SYSTEMS

Let's fix the error on your server permanently

By analyzing cPanel, WHM, CloudLinux, LiteSpeed, MariaDB, Exim and security layers together, we fix the root cause of the failure instead of just removing the service.

Get Server Support WhatsApp
Top