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.

spare servers settings

Apache Modules

EasyApache4 > Customize > Apache Modules > search

apache modules

Search for and confirm the following are installed and enabled.

HTTP2 module for Apache HTTP Server

Proxy server module for the Apache HTTP server

FastCGI proxy module for the Apache HTTP server

HTTP/HTTPS proxy module for the Apache HTTP server

IP replacement module for the Apache HTTP Server

Memcache-based object cache module for the Apache HTTP Server

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 versions

PHP Extensions

EasyApache 4 > PHP Extensions

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


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

php fpm

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.

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).

nginx packages

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


50% OFF

Liquid Web Storm VPS

50% OFF

Dedicated Server


eclincher social media management platforHarness the power of social media with the eclincher professional grade social media management platform.


Fiverr Business
Fiverr Pro
CloudFlare Cloudflare Warp · Jump on the Internet fast lane by installing the WARP app. It's free and protects you from malware and Internet spies! #1dot1dot1dot1 — The free app that makes your Internet faster and safer. CloudFlare Warp+

Sponsored Links

This page contains affiliate links, which means that if you click on one of the product links and then purchase the product, I’ll receive a small fee. You’ll still pay the advertised amount so there’s no cost to you.