How to fix the Resource temporarily unavailable error in nginx?
This tutorial discusses using nginx + php-fpm (at the time of writing, the PHP version was 7.3).
If you experience the problem that when there is a small load on the server, all sites suddenly start to give a 502 Bad Gateway error. In the logs, you may see something like:
[error] 7460#7460: *5365312 connect() to unix:/run/php/php7.3-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream
This situation occurs because the operating system rejects attempts by nginx to connect to the Unix socket. The reason may be that the maximum number of connections to the socket has been exceeded, or the maximum number of unprocessed connections to the socket has been reached.