How Do I Limit PHP Workers For Each Subdomain On A Multisite?
One of the advantages of not using wildcard SSLs on multisite is each sub-site has its own NGINX configuration and its own PHP pool configuration file.
So, it becomes very easy to switch out the number of PHP workers allowed on each subdomain.
However, you can only make these changes on the command line. So:
- Log into your server as root or sudo using ssh
- Assuming that you’re using PHP 7.4, navigate to the 7.4 pool folder: “cd /etc/php/7.4/fpm/pool.d”
- In there you’ll see one file for each subdomain. Assuming you like to use the NANO editor, open one of the files: “sudo nano domainname.com“
- Edit the pm.max_children entry to set the maximum number of PHP workers for the domain.
- Use the CTRL-O key combination to save the file (assuming you’re using the NANO editor).
- Use the CTRL-X key combination to exit.
- Stop PHP: “systemctl stop php7.4-fpm”
- Start PHP: systemctl start php7.4-fpm”
Third Party Resources and Reading
An Introduction To PHP-FPM Tuning – Published by Tideways
More Topics In Tips, Techniques & Education.