Linux limits a process to 1024 file handles by default. There’s no practical reason for this as high-performance code can handle tens of thousands of sockets (i.e. nginx).

So let’s raise it to a million.

sudo nano /etc/security/limits.conf
# add:
* – nofile 1000000
root – nofile 1000000

sudo nano /etc/systemd/system.conf
# add:
DefaultLimitNOFILE=1000000

sudo nano /etc/sysctl.conf
# add:
fs.file-max = 1000000

sudo nano /etc/default/nginx
# add:
ULIMIT=”-n 1000000″

# reboot and verify with ulimit -n

# monitor connection counts
sudo apt install net-tools
netstat -an | grep :443 | grep -v TIME_WAIT | wc -l

Stay up to date with the latest news, releases and more.