解决PHP7无法监听9000端口问题/502错误解决办法
问题背景
昨晚帮配置nginx+php服务的时候,发生了一个奇怪的事情
netstat -anp|grep 9000查看9000端口,一直没有监听,于是nginx无法通过fastcgi来代理php请求。一直都是502
原因分析
因为php7升级了配置,默认不再监听9000端口了,监听的是/run/php/php7.0-fpm.sock
解决方案
找到/etc/php/7.0/fpm/pool.d/www.conf,用;注释掉sock监听的方式,增加9000端口监听
;listen = /run/php/php7.0-fpm.sock
listen = 9000
1
2
重启php7,可以service php7.0-fpm restart或者/etc/init.d/php7.0-fpm restart的方式重启。
检查nginx配置,看下是正确
server{
listen 80;
server_name localhost;
root "/www/xxxx/";
location / {
index index.php index.html index.htm;
autoindex off;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
---------------------
作者:Moshow郑锴
来源:CSDN
原文:https://blog.csdn.net/moshowgame/article/details/84135977
版权声明:本文为博主原创文章,转载请附上博文链接!
最新文章
- 如何整合最新的Flex sdk和Air sdk。
- css精灵
- github上下载的文件如何在本地运行
- python 字符串技巧 from python cookbook
- CCNA基础 IP地址子网划分
- 性能测试中TPS和并发用户数
- @Autowired @Resource用法
- nginx upstream模块--负载均衡
- mysql日志类型
- The ";Real"; Project Plan
- R-note1
- 同步内核缓冲区 sync、fsync和fdatasync函数
- hdu3294(manacher)
- CSS3盒子模型
- 《JAVA程序设计》_第九周学习总结
- BZOJ 1671: [Usaco2005 Dec]Knights of Ni 骑士 (bfs)
- Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法;关于如何查看 EntityValidationErrors 详细信息的解决方法
- 如何在ubuntu系统里面用新加装的硬盘对系统进行扩容
- 负载均衡(Load Balancing)学习笔记(一)
- D07——C语言基础学PYTHON
热门文章
- 一个简单实现的string类
- MySQL中的JSON类型
- js基础闭包练习题
- Redis安装、主从配置及两种高可用集群搭建
- 激活windows去掉右下角水印
- Java服务端口被占用问题
- spring boot 集成 sitemesh
- 【Tomcat】虚拟主机
- eclipse设置代码折叠展开快捷键
- ng add ng-zorro-antd 安装时报错 已经是管理员还需要权限Error: EPERM: operation not permitted, lstat 'C:\ngWorkspace\qd\node_modules\fsevents\node_modules'