Plesk: Apache-Server / PHP-FPM Tuning
Apache
In the following example, we change the Apache server settings to handle many visitors. To do this, we first run the following command:
apache2ctl -V | grep MPM
There can be two results: Prefork or Event
For Prefork modify the file /etc/apache2/mods-enabled/mpm_prefork.conf as follows:
nano /etc/apache2/mods-enabled/mpm_prefork.conf
MaxRequestWorkers 400
ServerLimit 400
For Event, we modify the /etc/apache2/mods-enabled/mpm_event.conf file as follows:
nano /etc/apache2/mods-enabled/mpm_event.conf
MaxRequestWorkers 400
ServerLimit 400
Then we restart the Apache2 server:
systemctl restart apache2
Note: Under CentOs the configuration file must be generated first, e.g. with
nano /etc/httpd/conf.modules.d/mpm_event.conf
Restarting the Apache server also works slightly different
systemctl restart httpd.service
PHP-FPM
In the following example we change the PHP settings under Plesk to handle many visitors. First of all, we should make sure that the latest PHP version is used if possible. The execution should be done as FPM by Apache. Also the memory_limit should be chosen appropriately (256M / 512M). opcache.enable should be set to on. pm.max_children to 12 and pm to ondemand. Under additional directives the following can be entered:
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=512
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=16229
opcache.max_wasted_percentage=10
opcache.revalidate_freq=0
opcache.validate_timestamps=1
opcache.revalidate_freq=0
opcache.fast_shutdown=0
opcache.enable_file_override=0
opcache.max_file_size=0
pm.process_idle_timeout=120s
Of course, the opcache module should be installed for this.
mod_pagespeed
Also, mod_pagespeed can be installed on Plesk under Extensions/Extensions. If an error occurs during the installation, the following command must be executed in the SSH console:
apt-get install -y sudo