Table of Contents
Why WordPress is Slow (And How to Fix It)
WordPress generates pages dynamically — every page request executes PHP code, makes database queries, and assembles HTML before sending it to the browser. On a busy website with 50+ plugins, this process can take 2-5 seconds. The solution is caching: pre-generating pages and serving them as static files, bypassing PHP and MySQL entirely for most requests.
PHP-FPM Configuration for WordPress
PHP-FPM (FastCGI Process Manager) manages PHP worker processes. Proper configuration prevents bottlenecks:
[www]
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
pm.process_idle_timeout = 10sAdjust pm.max_children based on available RAM — each PHP process uses approximately 30-50 MB.
Redis Object Cache
WordPress makes dozens of database queries per page load. Redis stores the results of these queries in memory, dramatically reducing database load:
apt install redis-server php-redis -y
systemctl enable redisInstall the WP Redis plugin and add to wp-config.php: define('WP_CACHE', true);
NGINX FastCGI Cache for Static Page Serving
The ultimate WordPress optimization: cache entire pages as static files and serve them without executing PHP:
fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";With this configuration, cached pages are served in under 5ms regardless of WordPress complexity or plugin count.
Database Optimization
Run database maintenance regularly: OPTIMIZE TABLE wp_posts, wp_options, wp_postmeta;. Install WP-Optimize plugin for automated table optimization and log cleanup.
FAQ
Will caching break WooCommerce or dynamic pages?
Properly configured caching excludes cart, checkout, and account pages. These pages must always be served dynamically. NGINX FastCGI cache has built-in bypass rules for logged-in users and pages with cookies.
Ready to deploy?
Host WordPress on NVMe VPS
Dedicated vCores, NVMe storage, and root access for full WordPress optimization.
