Make sure that you are not confused in the exhaustion of workers on the PHP side, it was a problem setting up my laboratory server, which was configured to save RAM.
Basically, I forgot that you use one worker to process the main page for the end user, then the get_file_contents () function basically generates a separate HTTP request to the same web server, which requires 2 workers for a one-page download.
Since the first page used the last working one, the get_file_contents function was not available, so Nginx eventually answered with 504 on the first page because there was no response to the reverse proxy request.
source share