<p dir="ltr">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. </p>
<div class="gmail_quote">2 июля 2016 г. 10:25 пользователь "Francis Daly" <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> написал:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Jul 02, 2016 at 06:21:38AM +0000, yair avendaño wrote:<br>
<br>
Hi there,<br>
<div class="quoted-text"><br>
> 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.<br>
<br>
</div>"drupal" is possibly served by a http server, not a fastcgi server.<br>
<div class="quoted-text"><br>
> this gets me in the logs.<br>
><br>
><br>
> 016/07/02 00:51:57 [error] 18120#0: *61 upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://<a href="http://127.0.0.1:8080" rel="noreferrer" target="_blank">127.0.0.1:8080</a>", host: " localhost"<br>
<br>
</div>If you make a bad http request to a http server, it will likely return<br>
something that starts with "HTTP". The decimal value of ascii "H" is<br>
"72"; a fastcgi client may expect the first octet to refer to the fastcgi<br>
protocol version.<br>
<br>
So your error message hints that your upstream is not a fastcgi server<br>
but is a http server.<br>
<br>
Which in turn suggests that the fix is:<br>
<div class="quoted-text"><br>
> location ~ \.php$ {<br>
> # Test for non-existent scripts or throw a 404 error<br>
> # Without this line, nginx will blindly send any request ending in .php to php-fpm<br>
> try_files $uri =404;<br>
> include /etc/nginx/fastcgi.conf;<br>
<br>
</div>* delete those two<br>
<div class="quoted-text"><br>
> fastcgi_pass <a href="http://127.0.0.1:8080" rel="noreferrer" target="_blank">127.0.0.1:8080</a>; ## Make sure the socket corresponds with PHP-FPM conf file<br>
<br>
</div>* replace that with<br>
<br>
proxy_pass <a href="http://127.0.0.1:8080" rel="noreferrer" target="_blank">http://127.0.0.1:8080</a>;<br>
<br>
<br>
f<br>
<font color="#888888">--<br>
Francis Daly <a href="mailto:francis@daoine.org">francis@daoine.org</a><br>
</font><div class="elided-text"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></blockquote></div>