nginx+php显示 502 bad gateway的解决方法
来源:互联网 发布:合肥淘宝美工培训 编辑:程序博客网 时间:2024/05/20 10:52
502 Bad Gateway
在百度上查找错误信息:nginx+PHP 错误502 bad gateway时,也没有找到好的方法,
这时我分析我的nginx日志文件,我的nginx日志文件存放在/usr/local/nginx/logs/nginx_error.log,发现有如下一行的错误:
2016/02/22 15:12:26 [crit] 2967#0: *9 connect() to unix:/tmp/php-fcgi.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /2.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fcgi.sock:", host: "localhost"
特别是:connect() to unix:/tmp/php-fcgi.sock failed (13: Permission denied) while connecting to upstream出错,
然后我检查我的nginx的sock文件的权限:
# ll /tmp
total 4
srwxrwxrwx 1 MySQL mysql 0 Feb 22 00:58 mysql.sock
drwxr-xr-x 3 root root 4096 Feb 16 13:59 pear
srw-rw---- 1 root root 0 Feb 22 00:58 php-fcgi.sock
修改后的权限
[root@centos3 nginx]# chmod 777 /tmp/php-fcgi.sock
[root@centos3 nginx]# ll /tmp
total 4
srwxrwxrwx 1 mysql mysql 0 Feb 22 00:58 mysql.sock
drwxr-xr-x 3 root root 4096 Feb 16 13:59 pear
srwxrwxrwx 1 root root 0 Feb 22 00:58 php-fcgi.sock
显示的结果:
# curl localhost/2.php
This is a test
[root@centos3 nginx]#
这时nginx的502错误已解决了;
更多PHP相关技术请搜索千锋PHP,做真实的自己,用良心做教育。
互联网+时代,时刻要保持学习,携手千锋PHP,Dream It Possible。
- nginx+php显示 502 bad gateway的解决方法
- nginx+php显示 502 bad gateway的解决方法
- nginx+php显示 502 bad gateway的解决方法
- nginx+php显示 502 bad gateway的解决方法
- 经验之谈:nginx php 502 bad gateway 解决方法
- Nginx 502 bad gateway问题的解决方法
- Nginx 502 bad gateway问题的解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx+php-fpm出现502 bad gateway错误解决方法
- nginx 502 Bad Gateway 的一种解决方法(转载)
- Nginx 502 Bad Gateway错误的原因分析与解决方法
- Nginx 502 Bad Gateway 错误的原因及解决方法
- Nginx 502 Bad Gateway 错误的原因及解决方法
- ubuntu+nginx 出现502 bad gateway解决方法
- Java和MySQL数据类型对应表
- Altium Designer设计的pcb文件特别大原因分析之一!
- 热门头条的实现—MarqueeView、ViewFlipper
- php学习路线图
- 求黑色星期五-Calendar的使用
- nginx+php显示 502 bad gateway的解决方法
- 标示符定义的规则?
- Spark性能优化:资源调优篇
- 整数排序Ⅱ
- java实现二叉搜索树转双向链表
- 数据库设计规范
- openalyer4+geoserver+pgrouting+postgresql+QGIS 所需软件安装 (1)
- 在基本类型中,如果不明确指定,整数型的默认是什么类型?带小数的默认是什么类型?
- 34、第一个只出现一次的字符