Tips to optimize your cPanel 11.x server

It is not that this information is completely new, but we will try to collect the best tips to optimize your cPanel server. Some are not strictly for servers that work in cPanel and can be applied to other servers based on Apache

First you must log in as root on your server using SSH.

All the important configuration options are stored by Apache in a configuration file called httpd.conf which is located in /usr/local/apache/conf/httpd.conf. Therefore we will start by opening this file with your favorite text editor such as:

nano /usr/local/apache/conf/httpd.conf

MaxClients - Total number of connections allowed at the same time. Locate it in the configuration file. It should be set at a fair value. The formula to obtain an optimal value for your server is: MaxClients = 150 x RAM (GB). So for example if you have 2GB of RAM you should set it to 300. You should not set a value higher than this as it can cause the server to crash in case you suffer a DOS attack, but too low a value can also cause problems Wait time for your customers if that value is reached.
MinSpareServers and MaxSpareServers - MaxSpareServers and MinSpareServers control how many Apache "child" processes, which are inactive, will remain in operation while waiting for requests to remove them from inactivity. Each "child" process consumes resources, so having a value in your MaxSpareServers that is too high can cause resource problems. On the other hand, if the number of inactive processes is less than the MinSpareServers, Apache will assume new child processes (in an expensive operation) until the MinSpareServers is satisfied. C
If you do not know how to determine the optimal values for your system, these are the ones considered for most:
MinSpareServers 5
MaxSpareServers 10
If you have more than 2GB of RAM and run processes that consume a lot of resources you can consider increasing the MaxSpareServers

MaxRequestsPerChild - Controls the number of requests that a "child" attends before it is completed. It should not be set to a very low number since it would be too much for the Apache server to relaunch the Son pro-Son. An optimal value is usually:
MaxRequestsPerChild 1000

KeepAlivey MaxKeepAliveRequests - KeepAlive allows for longer HTTP sessions that allow multiple requests to be sent by the same TCP connection. In some cases it has been shown that it results in a 50% speed increase in response times for HTML documents with many images, but also keeping it activated can consume resources intensively.
Activate KeepAlive or not?

Well the opinions are diverse. I would say DO NOT activate KeepAlive if you are using a shared server in hosting mode or if you want to be able to use most of your hardware. And YES you should activate it when the load time of your pages is the most important factor in your business and you have enough money to invest in powerful high-end equipment. If you activate it I suggest that you configure the MaxKeepAliveRequest in approximately 2 seconds.

StartServers - Sets the number of "child" processes created at the beginning of the system. This parameter depends largely on the type of server you are using. If you have pages with little web traffic you can set it to 5, but if you have a very intense use in both visits and traffic you should set it to a value similar to MaxClients.
Timeout - The amount of time that Apache will wait for 3 things: the time it takes to receive a GET request, the time it takes to receive TCP packets after a POST or PUT request and the time it takes to receive an ACK response in the transmission of TCP packets. The default value is 300, you should set it to a somewhat lower value, for example 150 is fine. It will also help in case you suffer DOS attacks like some that can occur if you have phpBB forums. NEVER set it to a value less than 90 since your users may have timeout problems
Once you have made all the necessary changes you must restart Apache.

service httpd restart

Important! After updating to cPanel 11 and recompiling Apache there is an extra step to make so that the changes you have made in the httpd are not lost.

From cPanel 11.x all Apache configurations are saved in a database and the configuration files are recreated each time an account is added or another one is recompiled.

To save the changes in the database you must execute:

/ usr / local / cpanel / bin / apache_conf_distiller -update

You can also check if the changes have been accepted and will not be discarded in the next recompilation by running:

/ usr / local / cpanel / bin / build_apache_conf

Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 5470