Erro 502 Bad Gateway help
Yuriy Medvedev
medvedev.yp at gmail.com
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 daoine.org>
написал:
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:
127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream:
"fastcgi://127.0.0.1:8080", 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
error
> # 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 127.0.0.1:8080; ## Make sure the
socket corresponds with PHP-FPM conf file
* replace that with
proxy_pass http://127.0.0.1:8080;
f
--
Francis Daly francis at daoine.org
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160702/5b9d14c6/attachment.html>
More information about the nginx
mailing list