Wordpress Server Tuning

Utilities used:

php-fpm

1
2
3
cores=$(nproc --all)

sudo python ps_mem.py | grep php-fpm

Static

1
max_children		(Total RAM – Memory used for Linux, DB, etc.) / process size

Dynamic

1
2
3
4
max_children		(Total RAM – Memory used for Linux, DB, etc.) / process size
start_servers		CPU cores x 4
min_spare_servers	CPU cores x 2
max_spare_servers	CPU cores x 4 (=start_servers)

from An Introduction to PHP-FPM Tuning – Tideways

nginx

Security focused setup: Best practice secure NGINX configuration for Wordpress - GetPageSpeed

mysql

Run mysqltuner.pl and implement.

Wordpress

Dev

1
2
3
4
5
6
7
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true ); // → wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
define( 'SCRIPT_DEBUG', true );

// define( 'SAVEQUERIES', true );

Prod

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
define( 'WP_DEBUG', false );
@ini_set( 'display_errors', 0 );

define('FS_METHOD', 'direct'); // No updates in admin
define('DISALLOW_FILE_EDIT', true); // No edit in admin
define('DISALLOW_FILE_MODS',true);
define('DISABLE_WP_CRON', true);
define('WP_POST_REVISIONS', '2');

define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT','512M');

Related Articles