title: Nginx Upstream prematurely closed FastCGI stdout while reading response header from upstream
body: <p>I am aware that there are many similar questions posted on stackoverflow, I have been through them but it still doesn't resolve my issue. Please read on before marking it as a similar question.</p>
  <p>I have hosted my laravel based web application through the use of Nginx. The web application is accessible just fine both locally and through the server. However there is a particular URL where when too much data is being returned, it results in the server crashing and returning 404 error.</p>
  <p>In nginx error logs the following error message is shown</p>
  <pre><code>Nginx Upstream prematurely closed FastCGI stdout while reading response header from upstream
  </code></pre>
  <p>Attempted Solution
  I have tried adjusting settings from both PHP ini files as well as nginx conf files to no avail. I also restarted the server using</p>
  <pre><code>systemctl restart nginx
  systemctl restart php-fpm
  </code></pre>
  <p>PHP.ini</p>
  <pre><code>upload_max_filesize = 256M
  post_max_size = 1000M
  </code></pre>
  <p>nginx conf</p>
  <pre><code>client_max_body_size 300M;
  client_body_timeout 2024;
  client_header_timeout 2024;
  
  fastcgi_buffers 16 512k
  fastcgi_buffer_size 512k
  fastcgi_read_timeout 500;
  fastcgi_send_timeout 500;
  </code></pre>
  <p>Can someone kindly tell me what i am missing out?</p>