Most WordPress speed guides tell you to install another caching plugin. I've seen sites with five different caching layers that still crawl because the server underneath is misconfigured. The fastest path to better load times lives in your hosting stack—OPcache, object caching, PHP worker pools, compression, and HTTP protocol settings.
These five server configs deliver measurable gains without touching your theme or adding JavaScript. I'll walk through each one with the actual commands and settings I use when a support ticket says "my WordPress site is slow."
Enable OPcache and tune it for WordPress
PHP compiles your WordPress files every time someone visits a page. OPcache stores the compiled bytecode in memory so PHP skips that step on the next request. The performance gap between OPcache enabled and disabled is enormous.
Most hosting providers enable OPcache by default now, but the default memory allocation is often too small for WordPress. A typical WordPress install with a dozen plugins can consume 64 MB or more of OPcache memory.
Check if OPcache is active by creating a phpinfo.php file in your public_html:
<?php phpinfo(); ?>
Visit yoursite.com/phpinfo.php and search for "opcache." If you see opcache.enable => On, you're halfway there. Delete that phpinfo file afterward.
The settings that matter:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
On a VPS you control, edit /etc/php.ini or the appropriate php.ini for your PHP version (usually in /etc/php/8.x/fpm/php.ini or /opt/cpanel/ea-phpXX/root/etc/php.ini on cPanel). Restart PHP-FPM after changing these.
Shared hosting users can sometimes override settings via .user.ini in the site root, but OPcache directives often require server-level access. Contact support if you don't see the changes take effect.
One thing to watch: opcache.revalidate_freq controls how often PHP checks if your files changed. A higher number (60 seconds) reduces disk I/O but means code changes take a minute to appear. During active development I drop this to 2 or disable OPcache validation entirely.
Add a persistent object cache with Redis or Memcached
WordPress caches database query results, post objects, and taxonomy data in memory during each page load, then throws it all away when the request finishes. A persistent object cache keeps that data across requests so the database gets hit far less often.
Redis is my default choice because it's stable, fast, and well-supported by WordPress plugins. Memcached works too; the performance difference is negligible for typical WordPress workloads.
Install Redis on your server first. On Ubuntu/Debian:
sudo apt update
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server
On CentOS/AlmaLinux:
sudo yum install redis
sudo systemctl enable redis
sudo systemctl start redis
cPanel servers often include Redis in EasyApache or as a separate module. Check WHM under "Module Installers" or install it via WHM > EasyApache 4 > Customize > PHP Extensions > redis.
Once Redis is running, confirm it responds:
redis-cli ping
You should see PONG.
Now connect WordPress to Redis. Install the Redis Object Cache plugin from the WordPress repository, activate it, then click "Enable Object Cache" in Settings > Redis. The plugin drops an object-cache.php file into wp-content that intercepts WordPress's internal cache calls.
In support tickets I handled, the usual culprit when object cache won't enable is file permission on wp-content or a read-only filesystem. Check that WordPress can write to wp-content and that you're not running in some unusual safe-mode configuration.
The performance gain depends on how query-heavy your site is. A blog with mostly static content won't see much change. A WooCommerce store or membership site with complex queries per page load will feel night-and-day faster.
Tune PHP-FPM worker pools for concurrent traffic
PHP-FPM handles incoming PHP requests via worker processes. Too few workers and requests queue up waiting for a free slot. Too many workers and you exhaust RAM, triggering swap and killing performance.
The default PHP-FPM config on most servers spawns a fixed number of workers or uses dynamic allocation with conservative limits. WordPress can easily saturate the default pool during traffic spikes or when an admin runs a heavy import.
Find your PHP-FPM pool config. On Ubuntu it's usually /etc/php/8.x/fpm/pool.d/www.conf. On cPanel look in /opt/cpanel/ea-phpXX/root/etc/php-fpm.d/ for a file matching your domain or user.
The relevant settings:
pm = dynamic
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 15
pm.max_requests = 500
pm.max_children is the ceiling. Each PHP-FPM worker consumes RAM—typically 30-80 MB depending on your plugins and theme. If you have 4 GB of RAM total, reserve 1-2 GB for the OS and other services, leaving 2-3 GB for PHP-FPM. Divide that by your per-worker memory to get a safe max_children.
Example: 3 GB available, 60 MB per worker, gives you around 50 max children. Start conservative and watch your memory usage under load.
pm.start_servers, pm.min_spare_servers, and pm.max_spare_servers control how many idle workers PHP-FPM keeps ready. Higher values reduce the lag when traffic arrives, but consume memory even when idle. I typically set start_servers to 20% of max_children and spare servers to 10-30% of max_children.
pm.max_requests recycles a worker after it handles this many requests. That clears any memory leaks in PHP code. Setting it to 500-1000 is a good balance.
After editing, restart PHP-FPM:
sudo systemctl restart php8.2-fpm
Or on cPanel:
/scripts/restartsrv_apache_php_fpm
Monitor /var/log/php-fpm/www-error.log (path varies by distro) for lines like server reached max_children setting. If you see that repeatedly, you need either more RAM or fewer max_children if you're already at your memory ceiling.
Enable and configure Gzip or Brotli compression
Compressing text assets—HTML, CSS, JavaScript—before sending them to the browser cuts transfer size by 60-80%. Smaller transfers mean faster page loads, especially on mobile connections.
Most servers support Gzip out of the box. Brotli is newer and compresses a bit better, but Gzip is universally compatible and the difference is marginal for typical WordPress payloads.
If you're on Apache (most shared and cPanel hosting), check that mod_deflate is loaded:
apachectl -M | grep deflate
You should see deflate_module (shared). If not, enable it in WHM > EasyApache 4 > Apache Modules or ask your host.
Add this to your .htaccess in the WordPress root:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml
</IfModule>
Nginx users add a gzip block in the server or location context (often in /etc/nginx/nginx.conf or a site-specific conf file):
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml+rss;
Reload Nginx:
sudo nginx -s reload
Test compression by fetching a page with curl:
curl -I -H "Accept-Encoding: gzip" https://yoursite.com/
Look for a Content-Encoding: gzip header in the response. If it's missing, double-check your config syntax and that the module is active.
Brotli setup is similar but requires installing mod_brotli (Apache) or the brotli module (Nginx). It's worth the extra step if you're on a VPS and want every percentage point of compression gain, but Gzip alone delivers most of the benefit.
Switch to HTTP/2 (or HTTP/3)
HTTP/1.1 opens one connection per resource and processes requests serially. HTTP/2 multiplexes many requests over a single connection, reducing latency and overhead. The difference is especially visible when loading a WordPress page with dozens of CSS, JS, and image files.
HTTP/2 requires HTTPS, so ensure you have an SSL certificate active first. Most hosts offer free Let's Encrypt certs now.
On Apache with a recent version (2.4.17+), HTTP/2 support comes via mod_http2. Enable it:
sudo a2enmod http2
sudo systemctl restart apache2
cPanel users can enable HTTP/2 in WHM > EasyApache 4 > Apache Modules > http2. Make sure the mpm_event module is active instead of mpm_prefork, because HTTP/2 doesn't work well with prefork.
Nginx has built-in HTTP/2 support in recent versions. Add http2 to your listen directive in the server block:
listen 443 ssl http2;
Reload Nginx and test by opening your site in Chrome DevTools. Under the Network tab, add a "Protocol" column. You should see h2 for resources loaded over HTTP/2.
HTTP/3 (which uses QUIC instead of TCP) is available in newer Nginx and some CDN layers, but browser and server support is still rolling out. HTTP/2 is the proven, stable option right now.
What to check first
These five server configs—OPcache, persistent object cache, PHP-FPM tuning, compression, and HTTP/2—cut WordPress load times without adding another plugin. Start with OPcache and compression because they're low-risk and deliver immediate gains. Object cache and PHP-FPM tuning require more monitoring and adjustment based on your traffic and available RAM, but they're where the biggest improvements live for dynamic, database-heavy WordPress sites.
Check your current baseline with a tool like WebPageTest or GTmetrix before making changes, then measure again after each config. You'll see which settings move the needle for your specific workload.
How much RAM should I allocate to OPcache for a typical WordPress site?
Start with 128 MB and monitor OPcache usage via your server's PHP-FPM status page or a monitoring tool. A site with 10-15 plugins usually fits comfortably under 128 MB. If you see OPcache memory exhaustion in logs or phpinfo shows high cache full percentage, bump it to 256 MB.
Can I run Redis and Memcached at the same time?
Yes, but there's no benefit. WordPress's object cache drop-in talks to one backend. Pick Redis or Memcached and stick with it. Running both just consumes extra RAM.
Will these configs work on shared hosting?
OPcache and HTTP/2 usually yes, because hosts enable them by default. Object cache, PHP-FPM tuning, and compression config depend on the hosting plan. Budget shared hosting rarely gives you access to php.ini or FPM pool settings. If you hit that wall, it's a sign you've outgrown the hosting tier.
How do I know if PHP-FPM workers are the bottleneck?
Watch your PHP-FPM error log for max_children warnings and check server load during traffic spikes. If load stays low but pages are slow, it's probably database or plugin queries, not FPM workers. If load spikes and you see queued requests in logs, add more workers or RAM.
Does HTTP/2 replace the need for a CDN?
No. HTTP/2 speeds up the connection between the visitor and your origin server. A CDN caches assets geographically closer to visitors and absorbs traffic so your origin doesn't get hammered. Use both.
