Nginx + PHP-FPM Configuration
Nginx and PHP-FPM configuration for real load
The most common cause of errors under load is not a weak server but a worker count set at installation and never recalculated. Too few and visitors queue and time out. Too many and the server exhausts its memory, after which the system starts killing processes.
What is included
- calculating the PHP worker count against your actual memory — after measuring what one process really consumes on your site;
- choosing a process management mode that matches your load profile;
- timeouts, upload limits, buffer sizes;
- the PHP opcode cache — frequently disabled or sized too small;
- static file serving, compression, HTTP/2, keepalive;
- page caching at web server level, where it fits.
Why you cannot take a configuration from the internet
Because the values in articles are calculated for a different memory budget. On a heavy store a single worker can consume three times the typical figure — and a configuration that works well for the article's author will cause crashes on your server.
What you receive
A configuration matched to your server with an explanation of why each value was chosen, and a marker for the traffic level at which it will stop being enough. Plus before-and-after measurements, so the effect is observed rather than assumed.