Checklist for optimizing WordPress performance on Linux servers

The Complete WordPress Performance Checklist

, , ,

Series: WordPress Performance on DirectAdmin (Rocky Linux 9)

Phase 8: Authority & Wrap-Up — Part 29 of 30

The Complete WordPress Performance Checklist for DirectAdmin on Rocky Linux 9

Introduction

This checklist distills actionable steps for sysadmins seeking optimal WordPress performance on DirectAdmin-managed Rocky Linux 9 servers. It covers server, PHP-FPM, webserver, and WordPress-level improvements. Each step highlights DirectAdmin specifics, safe-by-default commands, and practical testing methods. Validate all changes in staging before production deployment.

1. System and OS-Level Tuning

  • Keep Rocky Linux 9 Updated:
    sudo dnf update -y

    Schedule regular OS updates and reboot for kernel/security patches. Test updates in a non-production environment first.

  • Optimize Swappiness:
    sudo sysctl vm.swappiness=10
    echo 'vm.swappiness = 10' | sudo tee /etc/sysctl.d/99-swappiness.conf
    sudo sysctl --system

    Reduces swap usage for better performance on memory-constrained servers.

  • Review Resource Limits:
    ulimit -n

    For high-traffic sites, increase open file limits in /etc/security/limits.conf if needed.

  • Disable Unnecessary Services:
    sudo systemctl list-unit-files --state=enabled
    sudo systemctl disable --now bluetooth cups

    Keep only essential services enabled.

2. DirectAdmin Webserver and PHP-FPM Configuration

Webserver (NGINX or Apache)

  • Check Which Stack is Active:
    sudo /usr/local/directadmin/custombuild/build used_configs
  • NGINX: Tune worker settings in /etc/nginx/nginx.conf:
    worker_processes auto;
    worker_connections 4096;

    Reload NGINX after changes:

    sudo systemctl reload nginx
  • Apache: Adjust /etc/httpd/conf/extra/httpd-mpm.conf for event MPM:
    StartServers 2
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 25
    MaxRequestWorkers 150
    MaxConnectionsPerChild 1000

    Reload Apache:

    sudo systemctl reload httpd
  • DirectAdmin Webserver Templates:

    For persistent tuning, update custom templates in /usr/local/directadmin/data/templates/ and rebuild configs:

    cd /usr/local/directadmin/custombuild
    sudo ./build rewrite_confs

PHP-FPM Pool Tuning

  • Locate Pool Configs: /usr/local/phpXX/etc/php-fpm.d/USERNAME.conf (where XX is PHP version)
  • Recommended Starting Values for Moderate Traffic:
    pm = dynamic
    pm.max_children = 20
    pm.start_servers = 4
    pm.min_spare_servers = 2
    pm.max_spare_servers = 6
    pm.max_requests = 500

    Edit with sudo vi and reload PHP-FPM:

    sudo systemctl reload php-fpmXX

    Adjust for each domain as needed.

  • Increase memory_limit for large sites:
    php_admin_value[memory_limit] = 256M

OPcache

  • Check if enabled:
    php -i | grep opcache
  • Default OPcache values in /usr/local/phpXX/lib/php.ini:
    opcache.enable=1
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=16
    opcache.max_accelerated_files=8000
    opcache.revalidate_freq=60

    Reload PHP-FPM after changes.

3. Database Optimization (MariaDB/MySQL)

  • Set Sensible Defaults in /etc/my.cnf.d/server.cnf:
    [mysqld]
    innodb_buffer_pool_size=512M
    innodb_log_file_size=128M
    max_connections=100
    query_cache_type=0
    query_cache_size=0

    Adjust innodb_buffer_pool_size to 60–70% of available memory on DB-only servers.

    Warning: Changing innodb_log_file_size requires DB service restart and can cause downtime. Plan accordingly.

  • Restart MariaDB safely:
    sudo systemctl restart mariadb
  • Test DB status:
    mysqladmin -u root -p status

4. WordPress Core, Plugins, and Theme Best Practices

  • Keep Core, Plugins, and Themes Updated:
    wp core update
    wp plugin update --all
    wp theme update --all
  • Audit Plugin/Theme Load:
    wp plugin list
    wp theme list

    Deactivate and remove unused or heavy plugins/themes.

  • Minimize Autoloaded Options:
    wp option list --autoload=on --fields=option_name,size --order=desc --field=option_name

    Large autoloaded options slow every page load. Optimize as needed.

5. Caching and Content Delivery

  • Enable Full Page Caching:
    • Recommended: Use a plugin like WP Super Cache or W3 Total Cache.
    • Test cache status:
    • curl -I -H 'Cache-Control: no-cache' https://example.com/
  • Static Asset Caching (NGINX/Apache):
    • NGINX: Add to location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ block:
    • expires 30d;
      add_header Cache-Control "public, immutable";
    • Apache: In .htaccess or site config:
    • <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType image/png "access plus 30 days"
        ExpiresByType text/css "access plus 7 days"
      </IfModule>
  • Leverage a CDN for Global Assets:

    Update DNS or use a plugin to offload media. Verify CDN response with:

    curl -I https://cdn.example.com/path/to/image.jpg

6. Security and HTTP/2

  • Enable HTTPS Everywhere:
    sudo dnf install certbot
    sudo certbot --nginx -d example.com -d www.example.com

    Or use DirectAdmin’s SSL interface. Test with:

    curl -I https://example.com/
  • Force HTTP/2:
    • NGINX: Ensure listen 443 ssl http2; in server block.
    • Apache: Enable mod_http2 and add Protocols h2 http/1.1 to vhost.
    • Test with:
    • curl -I --http2 https://example.com/
  • Harden PHP:
    disable_functions = exec,passthru,shell_exec,system
    expose_php = Off

    Set in php.ini or pool config.

  • Check Server Firewall:
    sudo firewall-cmd --list-all
    sudo firewall-cmd --permanent --add-service=https
    sudo firewall-cmd --reload

7. Monitoring, Logging, and Testing

  • Monitor Server and Application Logs:
    sudo tail -f /var/log/nginx/access.log /var/log/nginx/error.log
    sudo tail -f /var/log/httpd/access_log /var/log/httpd/error_log
    sudo tail -f /var/lib/mysql/mariadb.log
    sudo tail -f /var/log/php-fpm/www-error.log
  • Profile Performance:
    • WP-CLI:
    • wp profile stage --all
    • Load Testing:
    • wrk -t4 -c40 -d30s https://example.com/
      k6 run script.js
  • Set Up Uptime and Resource Monitoring:

    Use systemctl status, top, htop, and third-party monitoring as needed.

8. Routine Maintenance and Review

  • Document all configuration changes and keep versioned backups.
  • Schedule regular reviews for plugin/theme bloat, database size, and log anomalies.
  • Test failover and backup restores quarterly.

Quick Reference Checklist

  • OS and DirectAdmin fully updated
  • Webserver and PHP-FPM pools tuned per domain
  • OPcache and database configured for available resources
  • WordPress core/plugins/themes minimal and current
  • Caching and CDN implemented
  • HTTPS and HTTP/2 enforced
  • Firewall, logs, and monitoring in place
  • All changes tested before production deployment

Testing Changes and Rollback

  • Test in staging first.
  • After any config change, reload/restart only the affected service; use systemctl and monitor logs.
  • Use wp-cli and curl to verify WordPress is healthy post-change.
  • Keep recent config and DB backups for fast rollback.

Note: This article offers general technical guidance. Validate all configurations in a safe environment before applying them to production.

Previous: How to Measure Real WordPress Performance (Not PageSpeed Scores)

Next: The Ideal WordPress Performance Stack for a DirectAdmin VPS

Smart reads for curious minds

We don’t spam! Read more in our privacy policy