Erro 502 Bad Gateway help

Yuriy Medvedev medvedev.yp at
Sat Jul 2 07:59:57 UTC 2016

Hi. You must use fastcgi_pass if you use fastcgi server as backend e.g.
php-fpm. If you use apache as backend you must use proxy_pass.
2 июля 2016 г. 10:25 пользователь "Francis Daly" <francis at>

On Sat, Jul 02, 2016 at 06:21:38AM +0000, yair avendaño wrote:

Hi there,

> Hi I'm setting up a nginx as a reverse proxy but to try to see a site
with drupal locally that have shown me 502 Bad Gateway error.

"drupal" is possibly served by a http server, not a fastcgi server.

> this gets me in the logs.
> 016/07/02 00:51:57 [error] 18120#0: *61 upstream sent unsupported FastCGI
protocol version: 72 while reading response header from upstream, client:, server: localhost, request: "GET / HTTP/1.1", upstream:
"fastcgi://", host: " localhost"

If you make a bad http request to a http server, it will likely return
something that starts with "HTTP". The decimal value of ascii "H" is
"72"; a fastcgi client may expect the first octet to refer to the fastcgi
protocol version.

So your error message hints that your upstream is not a fastcgi server
but is a http server.

Which in turn suggests that the fix is:

>                          location ~ \.php$ {
>                        # Test for non-existent scripts or throw a 404
>                        # Without this line, nginx will blindly send any
request ending in .php to php-fpm
>                        try_files $uri =404;
>                         include /etc/nginx/fastcgi.conf;

* delete those two

>                        fastcgi_pass;  ## Make sure the
socket corresponds with PHP-FPM conf file

* replace that with


Francis Daly        francis at

nginx mailing list
nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list