This guide extends the AlmaLinux 10 base web server template with a production-ready WordPress stack using Apache, PHP-FPM, and MariaDB.
1. Install PHP and Required Extensions
dnf install -y php-fpm php-mysqlnd php-gd php-cli php-curl \
php-mbstring php-bcmath php-zip php-opcache php-xml php-json php-intl \
php-pecl-imagick php-exif
2. Enable and Start PHP-FPM
systemctl enable --now php-fpm
systemctl status php-fpm
3. Apache to PHP-FPM Configuration
AlmaLinux ships with a default php.conf that already maps PHP to PHP-FPM. Ensure the handler includes the FPM socket:
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost/"
</FilesMatch>
4. PHP-FPM Pool Configuration
Confirm the FPM pool runs as Apache:
user = apache
group = apache
listen = /run/php-fpm/www.sock
listen.owner = apache
listen.group = apache
listen.mode = 0660
5. PHP Performance and Security Tuning
Create WordPress-specific overrides:
/etc/php.d/99-wordpress.ini
upload_max_filesize=64M
post_max_size=64M
memory_limit=256M
date.timezone=America/New_York
expose_php=0
Opcache tuning:
/etc/php.d/10-opcache-tune.ini
opcache.enable=1
opcache.memory_consumption=192
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=1
opcache.revalidate_freq=2
systemctl restart php-fpm
6. Final Notes
- Remove any temporary
phpinfo()files after testing - Ensure WordPress directories are owned by
apache:apache - MariaDB should remain bound to
127.0.0.1 - Snapshot the VM before cloning
Posted in Technical Guides