NinjaWeb

Contact Info

106 Anne rd Knoxfield 3180 Vic Australia

+61 (03) 82023009

info@ninjaweb.com.au

Contact us
Recommended Services
Supported Scripts
WordPress
Joomla
Drupal
Magento
Javascript
Angular
React
NodeJS
A_digital_illustration_in_a_semi-flat_and_slightly.png
Most slow WordPress sites on cPanel are victims of defaults – wrong PHP handler, no opcode cache, weak compression, noisy MySQL, and background bloat. This guide shows the exact cPanel and server tweaks that consistently drop TTFB and speed up real pages without adding sketchy plugins.

1) Pick the Right PHP Handler

The PHP handler decides how requests execute. For modern WordPress on cPanel, the winning order is typically: LiteSpeed LSAPI (with LiteSpeed Web Server), then PHP-FPM (with Apache), and avoid legacy suPHP where possible.

  • LiteSpeed + LSAPI – event driven, low memory, best concurrency. Ideal on Managed WordPress Hosting stacks.
  • Apache + PHP-FPM – solid performance when tuned. Make sure pools are sized to actual traffic.
  • suPHP – isolates per user but tends to be slow. Only keep it where policy requires.

PHP-FPM pool baseline

; /opt/cpanel/ea-php82/root/etc/php-fpm.d/domain.conf
[domain.com]
user = domain
group = domain
listen = /opt/cpanel/ea-php82/root/usr/var/run/domain.com.sock
pm = dynamic
pm.max_children = 8        ; 1-2 GB RAM: 6-8, 4 GB: 10-12, 8 GB: 20-24
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 500
request_terminate_timeout = 120s

2) Turn On OPcache and Verify It

OPcache avoids recompiling PHP on every request. Enable it in MultiPHP INI Editor and verify usage.

php.ini essentials

; php.ini (per domain or global)
opcache.enable = 1
opcache.memory_consumption = 192
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
opcache.validate_timestamps = 0
opcache.revalidate_freq = 0

Quick OPcache sanity check

# if opcache gui is installed
php -i | grep -i opcache

3) Compression – Brotli and gzip

Serve fewer bytes. Prefer Brotli for modern browsers, fall back to gzip for legacy.

Apache – enable Brotli and gzip

# Ensure mod_brotli and mod_deflate are enabled in EasyApache 4
# .htaccess (root of WordPress)
<IfModule mod_brotli.c>
  BrotliCompressionQuality 5
  AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css application/javascript application/json image/svg+xml
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json image/svg+xml
</IfModule>

<IfModule mod_headers.c>
  Header append Vary Accept-Encoding
</IfModule>

LiteSpeed – compression and HTTP/3

# /usr/local/lsws/conf/httpd_config.conf
http3 1
brotli 1
gzip 1

4) Cache Layers That Actually Work

Use a page cache for anonymous users and object cache for dynamic requests. With LiteSpeed, the LSCache plugin coordinates purge and ESI. With Apache, pair a page cache plugin with Redis object cache.

  • Page cache – entire HTML for logged-out users.
  • Object cache – store database results and transients (Redis).
  • Browser cache – long TTL for static assets.

Redis minimal config

# /etc/redis/redis.conf
maxmemory 256mb
maxmemory-policy allkeys-lru
appendonly no

5) MySQL – a small set of changes with big impact

Focus on InnoDB buffer pool and realistic connection limits. Huge max_connections kills RAM and stability.

MariaDB my.cnf baseline

# /etc/my.cnf.d/server.cnf
[mysqld]
innodb_buffer_pool_size = 1G      # 2 GB RAM: 512M-1G, 4 GB: 1.5-2G
innodb_log_file_size    = 256M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method     = O_DIRECT
tmp_table_size          = 64M
max_heap_table_size     = 64M
max_connections         = 100     # keep realistic
table_open_cache        = 4000
thread_cache_size       = 100

After changes, restart MySQL and watch slow queries. Index WooCommerce order tables and search tables where needed.

6) DNS and Resolver Tuning

Slow name resolution can quietly add hundreds of milliseconds. Use fast public resolvers on the server and short TTL for dynamic records.

Server resolvers

# /etc/resolv.conf
nameserver 1.1.1.1
nameserver 8.8.8.8
options timeout:2 attempts:2

If you manage zones in cPanel, set sane TTLs. For public edge, a CDN like Cloudflare helps reduce lookup and TLS handshake time – see Advanced IT Support for implementation notes.

7) Disable the Bloat

Free CPU and RAM by removing what you do not use.

  • Disable legacy CGI handlers you do not need.
  • Turn off heavy web stats daemons if a CDN already gives you analytics.
  • Trim Apache modules – only keep what your stack needs.

cpanel-userdata check

# list domains and handlers
grep -R "php" /var/cpanel/userdata/ | head

8) WordPress-side fixes that multiply server gains

  • Keep plugins lean – fewer autoloaded options, fewer hooks.
  • Serve WebP, lazy load images, and defer non-critical JS via your cache plugin.
  • Use a modern theme with minimal blocking assets.

Tie server and app together – a fast server with a bloated theme still feels slow. See SEO guidance for Core Web Vitals alignment.

9) Verify – do not guess

Measure real improvements under load, not just single-user tests.

# check headers to confirm cache/compression
curl -I https://example.com | egrep -i "cache|br|gzip|hit"

# quick concurrency smoke
ab -n 1000 -c 50 https://example.com/

# live resource view
htop

10) Ninja Checklist – cPanel Speed Wins

  • LiteSpeed + LSAPI or Apache + PHP-FPM – pick one and tune pools.
  • Enable OPcache – confirm memory is sufficient and in use.
  • Brotli on, gzip as fallback – Vary header set.
  • Page cache + Redis object cache – verified hits.
  • MariaDB buffer pool sized – realistic max_connections.
  • Fast resolvers – short TTL for moving parts.
  • Disable bloat – fewer modules and daemons.

If you run WordPress for clients, bake these into your baseline so new sites launch fast by default. For reference architectures and migrations, see Business Solutions and Web Hosting notes.