Why Tune Apache for WordPress?
Apache with default settings can become a bottleneck for WordPress under moderate traffic. Proper tuning of the MPM module, caching, and connection handling ensures your WordPress site on a Breeze remains fast and stable during traffic spikes.
Prerequisites
- A Breeze running Ubuntu 22.04+ with Apache and WordPress installed
- Root or sudo access
Step 1: Switch to the Event MPM
The event MPM handles concurrent connections more efficiently than prefork:
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.3-fpmStep 2: Tune MPM Event Settings
sudo nano /etc/apache2/mods-available/mpm_event.conf<IfModule mpm_event_module>
StartServers 4
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 5000
</IfModule>Step 3: Enable Compression and Caching
sudo a2enmod deflate headers expires
sudo nano /etc/apache2/conf-available/performance.conf<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>sudo a2enconf performanceStep 4: Disable Unnecessary Modules
sudo a2dismod autoindex status cgi
sudo systemctl restart apache2Additional Tips
- Use
KeepAlive OnwithKeepAliveTimeout 3for balanced connection reuse - Disable
.htaccesslookups withAllowOverride Nonewhere possible and place rules in the vhost - Monitor Apache with
apachectl -Mto verify only needed modules are loaded on your Breeze