Performance tuning for WordPress on Ubuntu + Apache + PHP-FPM

ubuntulinuxwordpressapachephp-fpmhostingops

Performance problems often show up as instability—503s, timeouts, or random slowness—before they look like “slow pages.” This guide covers the main tuning layers and common mistakes so you fix the right thing first.

Start with measurement

Key tuning layers

LayerPurposeCommon mistakes
OPcachePHP bytecode cachingDisabled or undersized
Object cacheDB query reductionMisconfigured Redis/Memcached
Page cacheHTML cachingCaching logged-in users
CDNEdge deliveryCaching dynamic or admin routes

PHP-FPM basics

FAQ

Site is slow and sometimes returns 503.
Check PHP-FPM pool size and memory limits. If workers are exhausted or hitting memory limits, you’ll see 502/503. Use 500 triage to confirm it’s PHP-FPM and not Apache or WordPress.

Should I enable OPcache on production?
Yes. It’s the highest-impact PHP tuning for WordPress. Enable it in the PHP version that serves the site (often in php.ini or the PHP-FPM pool) and set a sensible memory_consumption and max_accelerated_files.