Truncated or invalid FastCGI responses

When setting up an Nginx frontend for a website that heavily relies on AJAX (Asynchronous JavaScript and XML) along with a FastCGI backend such as PHP, you may run into different sorts of problems. If your server returns truncated AJAX responses, invalid JSON values, or even empty responses, you may want to check your configuration for the following elements:

  • Have you set up a writable directory for the temporary FastCGI files? Make sure you do so via the fastcgi_temp_path directive.
  • If fastcgi_buffering is set to off, all FastCGI responses are forwarded to the client synchronously, in chunks of a certain size (determined by fastcgi_buffer_size).
  • In some cases, increasing the size and number of buffers allocated ...

Get Nginx HTTP Server - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.