Love2Code
Love2Code

Reputation: 918

Nginx 502 FastCGI Error

When I try to access a certain page on my server, it returns with a 502 Gateway error. (Sometimes it works but then I reload the page and it shows the 502 Gateway page again).

If I check the nginx error logs, this error comes up:

2017/09/13 19:14:49 [error] 3762#3762: *22 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: serverip, server: localhost, request: "GET /inventory.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "localhost", referrer: "localhost"

I tried looking up the error on google, but no solutions so far, and was wondering if someone knows what the error is & how to fix it.

Thanks.

Edit 1:

fastcgi_buffers 16 16k;

fastcgi_buffer_size 120k;

Upvotes: 1

Views: 2699

Answers (2)

Subrata Poddar
Subrata Poddar

Reputation: 29

I used below code in my nginx configuration and reload nginx, solved my issue -

fastcgi_buffers 16 16k;
fastcgi_buffer_size 120k;

Upvotes: 2

Talgat
Talgat

Reputation: 314

Try to increase values of the next settings:

fastcgi_buffer_size
fastcgi_buffers

https://nginx.ru/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffer_size https://nginx.ru/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers

Upvotes: 0

Related Questions