Optimize Web Server Performance
How to Optimize Web Server Performance

Optimizing your web server
The following recommendations are based on a VPS server with 4GB RAM and 2 Core CPU and with low to moderate traffic.
You will need to adjust for your specific server requirements, depending on your hardware configuration, traffic, applications, and a variety of possible variables.
Use these settings only as a general guideline and consult with your web hosting support BEFORE implementing.
The following settings also assume you’re using WHM/cPanel and have root access.
Apache (webserver) optimization
Global Configuration
Services Configuration > Apache Configuration > Global Configuration
Adjust the following as required.
- Maximum Spare Servers
This directive sets the desired maximum number of idle child server processes. Tuning of this parameter should only be necessary on very busy sites.
- If you have a very busy site, you can increase as necessary, even doubling the default.
Apache Modules
EasyApache4 > Customize > Apache Modules > search
Search for and confirm the following are installed and enabled.
mod_http2
HTTP2 module for Apache HTTP Server
mod_proxy
Proxy server module for the Apache HTTP server
mod_proxy_fcgi
FastCGI proxy module for the Apache HTTP server
mod_proxy_http
HTTP/HTTPS proxy module for the Apache HTTP server
mod_remoteip
IP replacement module for the Apache HTTP Server
mod_socache_memcache
Memcache-based object cache module for the Apache HTTP Server
mod_socache_redis
shared object cache provider which provides access to a cache backed by Redis
brotli (an advanced compression module)
Be sure to also enable brotli in Cloudflare.
PHP Versions
EasyApache 4 > PHP Versions
The recommendation is at least PHP 7.4.
PHP Extensions
EasyApache 4 > PHP Extensions
PHP Extensions > search for the following and install desired version(s).
PHP-FPM ((PHP Fast Process Manager)
Memcached (memory caching)
Improves performance (caches data and objects in memory to minimize database access)
OpCache (Compiles and caches a PHP script without executing it)
cPanel version of OpCache is called Zend OPcache
Search for Zend then install desired PHP version(s).
Click NEXT until you get to the last page of options then
Click PROVISION
MultiPHP Editor
Software > MultiPHP INI Editor
Basic Mode
Configure basic settings of a PHP version
Select the version from the drop-down
- allow_url_fopen
The recommended setting is Disabled (more secure) - file_uploads
The recommended setting is Enabled - max_execution_time
The recommended setting is 120 - max_input_time
The recommended setting is 60 - memory_limit
The recommended setting is 512 - post_max_size
The recommended setting is 100M - upload_max_filesize
The recommended setting is 100M - output_compression
The recommended setting is Enabled- IMPORTANT: Do NOT enable via cPanel > Optimize Website. When you use the cPanel option, code is added to the .htaccess file just for that domain. And this would have to be done for each domain. Instead, when Enabled via this zlib.output_compression, it’s Enabled server-wide without involving .htaccess. Always try to avoid adding code to .htaccess. The bigger this file grows, the more performance will be negatively affected.
All other options are set to default.
Click Apply then restart PHP-FPM (Restart Services > PHP-FPM)
MultiPHP Manager
Software > Multi-PHP Manager
System Settings (sets system default options)
PHP Version
Choose your desired PHP version from the drop-down menu.
This is the version that will be used as the DEFAULT for NEW installations.
PHP-FPM
The recommended setting is Enabled.
PHP Handlers
The recommendation is to leave them at default and contact support BEFORE changing defaults.
User Domain Settings
Here you can change the PHP Version on a per-account basis.
You can also enable/disable on a per-account basis.
If your server hosts multiple websites but has limited RAM, consider turning off PHP-FPM for low-traffic sites.
Clicking the PHP-FPM Settings button allows you to adjust on a per-account basis.
Additional Packages
Software > EasyApache 4 > Customize > Additional packages then search for nginx
NGINX Reverse Proxy
This will provide enhanced performance by caching pages on your server that have been previously requested and will serve them from cache memory (faster) instead of the disk (slower).
Enable the following:
- nginx
- nginx-brotli
- nginx-gzip
- nginx-http2
Once installed, configure as follows.
NGINX Manager > System Settings > Use caching by default
The recommended setting is enabled.
The proxy can also be enabled/disabled on a per-account basis:
NGINX Manager > User Settings > Enable/Disable
Here you can also clear the cache for each account.
Optimize MYSQL database
IMPORTANT: Always have a current backup available before performing database operations.
Log in to cPanel > Databases > phpMyAdmin
Click on the database you want to optimize
You will see a list of all the tables in the database
Scroll down to the bottom and select “Check all”
Open the drop-down to the right, under Table maintenance, select Optimize table
You should see this message at the top of the page: Your SQL query has been executed successfully.
If you use WordPress, the safer recommendation is to install the plugin WP-Optimize.
Optimize your web server, whether it’s a VPS server or a dedicated server. Faster page loads will improve your user experience and your conversions. Monitor your server’s performance and adjust as required.
Further reading: Apache Performance Tuning: MPM Directives