The project frequently had 502 504 errors during stress testing. Through various troubleshooting, we finally found the problem. It was caused by tcp access timeout.
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600; fastcgi_read _timeout 600;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
nginx proxy: connect() to ip:80 failed (99: Cannot assign address requested)
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_tw_recycle = 0
The above introduces the nginx stress test 502 504 error, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.