Fix "Too many open files" on Linux
Raise the open file descriptor limit the right way — per process, per user, and system-wide.
Problem
accept: too many open filesRoot cause
Linux caps the number of file descriptors per process. The default (1024) is far too low for any modern server.
Solution
Check current limit
ulimit -n && cat /proc/$(pgrep -f myapp)/limits | grep 'open files'Raise for systemd services
# /etc/systemd/system/myapp.service.d/override.conf
[Service]
LimitNOFILE=1048576sudo systemctl daemon-reload && sudo systemctl restart myappRaise per user (login shells)
# /etc/security/limits.d/nofile.conf
* soft nofile 1048576
* hard nofile 1048576Frequently asked questions
Related fixes
Linux
5 minDebug a Failed systemd Service
From `Active: failed` to a clean restart — how to read systemd logs and fix unit files.
#systemd#journalctl
Linux
4 minFix "Permission denied" Binding to Port 80 or 443 on Linux
Bind to privileged ports without running your app as root, using capabilities or sysctl.
#networking#capabilities#ports
Weekly digest
One DevOps fix in your inbox each week
Short, practical, no fluff. Real errors, real fixes — straight from production postmortems.