How to optimize a cPanel server for performance
June 24, 2018 TMZ Team

cPanel is the most widely used web hosting control panel in the market. It vastly simplifies system administration tasks. However, if not configured properly, it can also slow down your server. Here are a few simple ways to improve performance and get the most out of your server resources.

Disable unused services

cPanel integrates many handy features and services but there are few servers that actually use all of them. Unused services can still consume a good amount of resources, so you should disable them.

The menu found at Home -> Service Configuration -> Service Manager allows you to quickly inspect and disable most of these services.

Some of them, like Mailman or ClamAV, can really hurt performance and should be stopped if you don’t need them. However, it is a good practice to disable any un-necessary services, even if they have a minimal impact. Don’t disable services if you’re not sure of their function.

Keep in mind that you have to deselect both the Enabled and Monitor checkboxes, in order to prevent the service from being started again after a reboot.

The statistics software provided by cPanel can also slow down your system, so it’s time to tweak it.

Go to Home -> Server Configuration -> Statistics Software Configuration and click on the Configure Statistic Process Time Schedule on the bottom right.

In the new window, check the hours with the highest activity, when the system should not process logs.

If you have a large number of databases on your server, a single setting can provide a serious performance boost.

Go to Home -> Server Configuration -> Tweak Settings, click on the Software tab and disable phpMyAdmin information schema searches.

Tweak MySQL

The database service can eat up a lot of your server’s resources, so any performance tweaks are welcome.

MySQLTuner is a very useful script that can analyze your configuration files as well as the logs and warn you of any incorrect settings that decrease performance.

You can download and run the script from SSH with a simple one-line command:

curl -L http://mysqltuner.pl/ | perl

The script will display the various checks performed, then offer a number of recommendations.

The actual way to apply these recommendations is beyond the scope of this article. Some of them can be changed from the WHM interface, while others can only be tweaked in the /etc/my.cnf file.

Speed up your web server

The initial web server configuration provided by cPanel works well for small websites but can quickly become slow if you run complex services or host a large number of domains.

There are several ways to speed up your web server, both free and paid ones. The easiest thing to do is to activate the services already provided by cPanel.

In order to make scripts run faster, go to Home -> Software -> MultiPHP Manager and turn on Php-FPM for all your accounts.

A simple but effective caching solution is included in EasyApache. Navigate to Home -> Software -> EasyApache 4, then provision the package configured with OpCache.

Install Engintron

Nginx is a modern web server that can serve more requests than Apache and make your websites load faster. In addition, Nginx is an excellent caching solution, reduces RAM and CPU use and provides protection against many types of attacks, such as Slowloris.

Nginx can be installed and configured manually but the most effective method to include it in a cPanel environment is the free Engintron plugin.

Run the following one-liner from the command line to install Engintron:

cd /; rm -f engintron.sh; wget --no-check-certificate https://raw.githubusercontent.com/engintron/engintron/master/engintron.sh; bash engintron.sh install

After a few minutes, the plugin will be installed and becomes available in the Plugins section of the WHM interface.

No further configuration is needed, the plugin sets up Nginx as a frontend and reverse caching proxy for Apache for both secure and non-secure connections, speeding up your web server significantly.

Install LiteSpeed

LiteSpeed is an even faster web server that can boost your server performance further.

Unlike Nginx, LiteSpeed replaces Apache completely, providing not only a high-performance caching server but also its own custom PHP handler.

In order to install the LiteSpeed plugin for cPanel, execute this command from the command line:

cd /usr/src; curl https://www.litespeedtech.com/packages/cpanel/lsws_whm_plugin_install.sh | sh

You will then have to go to Home -> Plugins -> LiteSpeed Web Server Plugin and click on the Install LiteSpeed Web Server button.

LiteSpeed is not free and requires a license but you can also request a trial one in order to test it and decide if the performance boost is worth the increased cost.

cPanel is a very complex software and there are many settings that can be optimized, we have only scratched the surface in this article. The simple steps described can be implemented quickly and will make your server run much faster.

Would you like to run your own managed cPanel VPS? Check out the tmzVPS website.