How to raise ServerLimit and MaxClient

If your server starts getting more and more traffic you’ll need to lift up number of allowed Apache connections. This guide works only on cPanel/WHM powered servers.

The easy way
Log in at WHM and to go to Service Configuration > Apache Configuration > Global Configuration. In there find ServerLimit and MaxClients and set those to some nice value (eg. 1024 or 2048 depends how much memory you have). Save and that should be it.

The geek way
Edit of httpd.conf (usually located at /usr/local/apache/conf folder). It should look something like this (depending on your server specification):

StartServers        5
MinSpareServers     5
MaxSpareServers     10
ServerLimit         1024
MaxClients          1024
MaxRequestsPerChild 10000

Save, Distill settings, restart Apache:

/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart

Check
After you do something like this you simply MUST take a look at your Apache error_log file (usually located at /usr/local/apache/logs folder). If you see following line in Apache error_log:

** [warn] WARNING: Attempt to change ServerLimit ignored during restart

You should stop and run the Apache again since ServerLimit can’t be changed by restarting Apache. To do so execute following at SSH:

apachectl stop
apachectl start
Tags: serverlimit, apache serverlimit, WARNING: Attempt to change ServerLimit ignored during restart, serverlimit maxclients, serverlimit vs maxclients, serverlimit apache
Sysctl.conf hardening
How to format and mount second hard drive on Linux

Leave a Reply

Your email address will not be published / Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.