Introduction
When reviewing the Nginx error log, you may see errors like the one below.
socket() failed (24: Too many open files)
This can be resolved by increasing the open files Nginx is allowed to have.
Procedure
On a server using Systemd to manage services, do the following:
mkdir -vp /etc/systemd/system/nginx.service.d
Create a file with a .conf extension:
touch /etc/systemd/system/nginx.service.d/override.conf
Add the following:
[Service]
LimitNOFILE=4096
Reload Systemd daemon with:
systemctl daemon-reload
Then restart Nginx with the following:
/scripts/restartsrv_nginx --hard
Verify the changes using the following command:
grep 'open file' /proc/$(pgrep -u root -f 'nginx: master')/limits
Comments
0 comments
Article is closed for comments.