Checked out /var/log/php-fpm/error.log:
[23-Jun-2020 19:31:47] NOTICE: systemd monitor interval set to 10000ms
[23-Jun-2020 19:31:54] WARNING: [pool www] child 6042 exited on signal 11 (SIGSEGV) after 7.046424 seconds from start
[23-Jun-2020 19:31:54] NOTICE: [pool www] child 6044 started
[23-Jun-2020 19:32:51] WARNING: [pool www] child 6041 exited on signal 11 (SIGSEGV) after 64.163499 seconds from start
[23-Jun-2020 19:32:51] NOTICE: [pool www] child 6060 started
[23-Jun-2020 19:40:04] WARNING: [pool www] child 6034 exited on signal 11 (SIGSEGV) after 496.901954 seconds from start
This segfault in fpm causes nginx to fail with 502.
The reason may be anything - to many children, not enough RAM, not writable sessions directory. I had to disable opcache [opcache.enable=0]