Hitting too many open file limit for apache? In the previous OS versions, changing limits like open file number would be set in
or directly inside the start up script. In some ways the new method brings better organization to the limits, but its change is very confusing to people who were expecting the same. I myself was befuddled with the open file limit with the web server saying “Too many open files” and despite changing limits in the old way (which still exists), it just wasn’t solving it.
The limits are set according to specification set here:
/usr/lib/systemd/system/[name of service].service /usr/lib/systemd/system/httpd.service // apache example /usr/lib/systemd/system/mariadb.service // mariadb example
But it’s not recommended that you edit that. It’s because that’ll be over written with package update. What you should edit is:
/etc/systemd/system/[name of service].service.d/limits.conf
Often the folder for it won’t exist either. So you’ll have to make the folder first like (with httpd example):
# mkdir -p /etc/systemd/system/httpd.service.d/
Now create/edit/append a file so that the contents would be like below.
# cat /etc/systemd/system/httpd.service.d/limits.conf [Service] LimitNOFILE=20000
Now reload the system daemon so it learns of the update. This action alone doesn’t not restart any service.
# systemctl daemon-reload
And also restart the service itself.
# systemctl restart httpd