本文介绍了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中正确设置. conf .
  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网关错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:22