Apache2 with php-fpm8.3 configuration for WordPress(WooCommerce) site

devops-nginx

This configuration is a practical Apache 2.4 + PHP-FPM 8.3 baseline for a WordPress/WooCommerce site. It keeps PHP execution on FPM, keeps Apache routing explicit, and documents the exact values used on the server.

Apache Site Configuration (site.conf)

Use this virtual host fragment for the WordPress document root and FPM handler.

ServerName lalala.net
DocumentRoot /var/www/html/woocommerce

Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted

SetHandler "proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost/"

ProxyPass http://127.0.0.1:5000/
ProxyPassReverse http://127.0.0.1:5000/

<LocationMatch "/Pages(/.*)?$">
ProxyPass http://127.0.0.1:5000$1
ProxyPassReverse http://127.0.0.1:5000/

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Apache MPM Prefork (mpm_prefork.conf)

These values match your current high-concurrency prefork setup.

StartServers 10
MinSpareServers 10
MaxSpareServers 20
ServerLimit 1000
MaxRequestWorkers 1000
MaxConnectionsPerChild 0

PHP-FPM and PHP Runtime Settings

Apply the following limits in php.ini:

max_input_time = 600
max_input_vars = 5000
memory_limit = 8192M
upload_max_filesize = 512M
post_max_size = 512M
max_file_uploads = 50

Then set your FPM pool values in .fpm/pool.d/www.conf:

pm = dynamic
pm.max_children = 256
pm.start_servers = 16
pm.min_spare_servers = 16
pm.max_spare_servers = 32
pm.max_requests = 1000

Validation and Reload

apachectl configtest
php-fpm8.3 -t
systemctl reload apache2
systemctl reload php8.3-fpm

Official Documentation

Apache HTTP Server official docs: https://httpd.apache.org/docs/

Leave a Reply

Your email address will not be published. Required fields are marked *

โ˜• Support us ยท ๐Ÿ’ณ Monobank