nginx 502 网关错误 [英] nginx 502 bad gateway

查看:50
本文介绍了nginx 502 网关错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 spawn fcgi 生成 php5-cgi 时,我使用 nginx 得到了 502 Bad Gateway.

I get a 502 Bad Gateway with nginx when using spawn fcgi to spawn php5-cgi.

我使用 rc.local 中的以下行在服务器启动时使用它来跨越实例

I use this to span an instance on server start using the following line in rc.local

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

大概我收到错误是因为 spawn-fcgi/php5-cgi 死了,没有任何东西在那里听来解析 php.

presumably I'm getting the error because the spawn-fcgi / php5-cgi dies and there is nothing listening there anymore to parse php.

我在任何地方都看不到日志中的任何内容,我没有想法(并且不熟悉使用 nginx 进行此设置)

I get nothing in the logs that I can see anywhere, I'm out of ideas (and new to this setup with nginx)

推荐答案

我执行了我的 localhost 并且页面显示了 502 bad gateway 消息.这对我有帮助:

I executed my localhost and the page displayed the 502 bad gateway message. This helped me:

  1. 编辑/etc/php5/fpm/pool.d/www.conf
  2. listen =/var/run/php5-fpm.sock 更改为 listen = 127.0.0.1:9000
  3. 确保位置在 nginx 中正确设置.确认.
  4. 运行sudo service php5-fpm restart
  1. Edit /etc/php5/fpm/pool.d/www.conf
  2. Change listen = /var/run/php5-fpm.sock to listen = 127.0.0.1:9000
  3. Ensure the location is set properly in nginx.conf.
  4. Run sudo service php5-fpm restart

也许它会帮助你.

来源:http://wildlyinaccurate.com/solving-502-bad-gateway-with-nginx-php-fpm

这篇关于nginx 502 网关错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆