Optimized wordpress website for 1GB memory server
Photo by Shahadat Rahman
Optimized wordpress website for 1GB memory server
Adjusting PHP-FPM for Performance + Low Memory
PHP-FPM has as a default configuration that uses more memory than necessary. It has spare php-fpm processes ready to go, taking up memory in case there is PHP code to process. While not a problem if you have tons of RAM, it can be an issue for low RAM VPS and if you are using aggressive page caching then it is memory being used unnecessarily that could be used by MariaDB MySQL or other critical processes. I always use nginx with PHP-FPM running PHP 7.0 (or the latest version) so this tutorial explains how to tweak the configuration to use as little RAM as possible.
1sudo vim /etc/php/7.4/fpm/pool.d/www.conf
Change pm = dynamic
to pm = ondemand
Comment pm.start_servers
, pm.min_spare_servers
and pm.max_spare_servers
Then comment out for pm.process_idle_timeout
and pm.max_requests
Adjusting Mysql and MariaDB
1[mysqld]2symbolic-links=03skip-external-locking4key_buffer_size = 32K5max_allowed_packet = 4M6table_open_cache = 87sort_buffer_size = 128K8read_buffer_size = 512K9read_rnd_buffer_size = 512K10net_buffer_length = 4K11thread_stack = 480K12innodb_file_per_table13max_connections=10014max_user_connections=5015wait_timeout=5016interactive_timeout=5017long_query_time=5