问题描述
当使用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:
- 编辑
/etc/php5/fpm/pool.d/www.conf
- 将
listen = /var/run/php5-fpm.sock
更改为listen = 127.0.0.1:9000
- 确保位置已在nginx中正确设置. conf .
- 运行
sudo service php5-fpm restart
- Edit
/etc/php5/fpm/pool.d/www.conf
- Change
listen = /var/run/php5-fpm.sock
tolisten = 127.0.0.1:9000
- Ensure the location is set properly in nginx.conf.
- Run
sudo service php5-fpm restart
也许会对您有所帮助.
来源: http://wildlyinaccurate.com/solving -502-bad-gateway-with-nginx-php-fpm
这篇关于nginx 502网关错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!