Apache for WordPress – MPM Event, PHP-FPM, and Security
Published: April 14, 2026 · Author: Marcin Szewczyk-Wilgan
Apache HTTP Server remains one of the most widely deployed web servers in the world, and it is the default on a large proportion of shared hosting environments where WordPress runs. While Nginx gets more attention in performance discussions, Apache 2.4 with the Event MPM and PHP-FPM via mod_proxy_fcgi is a fully competitive stack for WordPress – and in some respects easier to work with, thanks to .htaccess support that lets WordPress manage its own rewrites without server configuration access. This guide covers the complete modern Apache setup for WordPress.
MPM Event – The Modern Apache Model
Apache's performance characteristics are defined largely by its Multi-Processing Module (MPM). The right choice for WordPress in 2026 is MPM Event.
a2dismod mpm_prefork; a2dismod mpm_worker; a2enmod mpm_event; systemctl restart apache2. Also disable mod_php: a2dismod php8.3 and enable PHP-FPM: a2enmod proxy_fcgi setenvif; a2enconf php8.3-fpm.PHP-FPM via mod_proxy_fcgi
With MPM Event, PHP execution is handled by PHP-FPM via the mod_proxy_fcgi module. This separates PHP processing from Apache's connection handling, giving each layer its own tuning parameters.
Connecting Apache to PHP-FPM
In the VirtualHost configuration: <FilesMatch "\.php$"> SetHandler "proxy:unix:/run/php/php8.3-fpm-wordpress.sock|fcgi://localhost/" </FilesMatch>. This passes all .php requests to PHP-FPM via a Unix socket. The pipe-separated syntax (unix:...) specifies the socket; fcgi://localhost/ is the FastCGI endpoint identifier.
Alternative FCGI module
mod_fcgid is an alternative to mod_proxy_fcgi that manages its own PHP-FPM-like process pool. It is simpler to configure on shared hosting environments. For VPS deployments where you control the full stack, mod_proxy_fcgi with a separately configured PHP-FPM pool gives better control over worker tuning and security isolation.
Same rules as Nginx
Unix sockets are faster for same-server communication. Configure PHP-FPM to listen on a Unix socket (listen = /run/php/php8.3-fpm-wordpress.sock) and point Apache's mod_proxy_fcgi at that socket. TCP (127.0.0.1:9000) is required only when PHP-FPM is on a separate server.
ThreadsPerChild and MaxRequestWorkers
Key MPM Event parameters: ServerLimit 16, StartServers 4, ThreadsPerChild 25, MaxRequestWorkers 400, MinSpareThreads 50, MaxSpareThreads 150. MaxRequestWorkers = ServerLimit × ThreadsPerChild. Tune based on server RAM after measuring PHP-FPM worker sizes.
WordPress .htaccess and Configuration
Apache's .htaccess support is its main advantage over Nginx for WordPress environments where server configuration access is limited. WordPress writes its own rewrite rules to .htaccess automatically.
RewriteEngine On and a catch-all rule that passes unresolved requests to index.php. This handles pretty permalinks, feeds, pagination, and custom post types without any server configuration changes. Never edit the WordPress-managed section between # BEGIN WordPress and # END WordPress markers.AllowOverride All (or at minimum AllowOverride FileInfo Options) for the document root. Without this, Apache ignores .htaccess files entirely and WordPress rewrite rules do not function.AllowOverride None globally and include the WordPress rewrite rules directly in the VirtualHost configuration. Apache then never checks for .htaccess files, eliminating the I/O overhead.<Files wp-config.php> deny from all </Files>. Add similar rules to block direct access to .env files, XML-RPC if unused, and PHP execution in the uploads directory: <Directory "/uploads"> php_admin_value engine off </Directory> (or via the SetHandler directive with MPM Event).mod_security and WAF
Apache's mod_security is a mature Web Application Firewall module that inspects HTTP requests against a ruleset before they reach WordPress.
apt install libapache2-mod-security2 and configure CRS rules from the owasp-modsecurity-crs package.SecRuleEngine DetectionOnly) to identify false positives before enabling blocking mode.Include /etc/modsecurity/crs/plugins/wordpress-config.conf. Review the exclusion rules before enabling in production.Security Hardening
Apache has several server-level security settings that should be configured on every WordPress server.
Hide Apache version
By default, Apache includes its version number and OS in error responses and headers. Set ServerTokens Prod and ServerSignature Off to suppress this. Version disclosure helps attackers match known vulnerabilities to your specific Apache version.
Disable directory browsing
Set Options -Indexes globally or per-directory to prevent Apache from generating directory listings when no index file is present. Directory browsing can expose file structure, uploaded content, and backup files. WordPress's .htaccess does not prevent this by default.
Adding via mod_headers
Enable mod_headers (a2enmod headers) and add: Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains", Header always set X-Content-Type-Options "nosniff", Header always set X-Frame-Options "SAMEORIGIN", Header always set Referrer-Policy "strict-origin-when-cross-origin".
Basic DDoS protection
mod_evasive detects and temporarily blocks IP addresses making an abnormally high number of requests. It is not a replacement for a proper network-level DDoS mitigation, but it provides basic protection against simple HTTP floods. Configure DOSHashTableSize, DOSPageCount, and DOSSiteCount thresholds based on your expected legitimate traffic.
Apache 2.4.66 and Recent Changes
Apache 2.4.66 (released in 2025) brought several improvements relevant to WordPress hosting. The most significant for performance is improved HTTP/2 server push integration and better handling of keep-alive connections under the Event MPM. Security improvements include updates to mod_ssl's cipher handling and improved request smuggling protections.
The key practical change for WordPress operators is impro