安装好nginx,php环境后,配置虚拟主机,结果访问后就报502 gateway,查看日志文件后,显示错误如下:

2019/04/29 16:24:39 [error] 19433#19433: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.52, server: 192.168.1.222, request: "GET / HTTP/1.1"

解决方案,先查看下php-fpm是否启动,然后查看虚拟主机配置中的 root 配置

server {
listen 80;
server_name 192.168.1.222; charset utf-8; location / {
root /data/wwwroot;
index index.php index.html index.htm;
} location ~ \.php$ {
#注意这里root配置与当前server下的root保持一致
#我的报错原因是我把root这项给删除
root /data/wwwroot;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

然后重启下nginx就可以访问了。

nginx访问502 gateway,*1 connect() failed (111: Connection refused) while connecting to upstream的更多相关文章

  1. 配置nginx.config 报错:connect() failed (111: Connection refused) while connecting to upstream解决

    php-fpm没有运行 执行如下命令查看是否启动了php-fpm,如果没有则启动你的php-fpm即可 查看: netstat -ant | grep 9000 执行 /usr/local/php/s ...

  2. nginx 报错 connect() failed (111: Connection refused) while connecting to upstream

    公司网站搬迁到新服务器后,发现站点访问不了,network里面提示502,查看相关的server配置,感觉没有什么问题,经过测试发现txt.html.等非php文件能够直接访问,也就是php访问不了, ...

  3. nginx 解决 connect() failed (111: Connection refused) while connecting to upstream,

    嗯哼,刚装了个ubuntu的lnmp,我的天啊,踩的坑比我脂肪还多了 比如刚装完的时候访问显示502, 也不知道什么问题,就去看了一下nginx日志  /var/log/nginx/error.log ...

  4. Nginx报错 connect() failed (111: Connection refused) while connecting to upstream 的解决方法

    今天访问公司的网站突然报错,抛出一些英文,提示看一下Nginx的error.log日志: cd  /usr/local/nginx/logs/  看到了error.log ,下一步 tail -n 2 ...

  5. [nginx] connect() failed (111: Connection refused) while connecting to upstream, client: 101.18.123.107, server: localhost,

    nginx一直报错, 2016/12/02 10:23:19 [error] 1472#0: *31 connect() failed (111: Connection refused)while c ...

  6. 解决connect() failed (111: Connection refused) while connecting to upstream

    使用nginx时, 有可能遇到connect() failed (111: Connection refused) while connecting to upstream的问题. 如果upstrea ...

  7. connect() failed (111: Connection refused) while connecting to upstream

    配置好lamp后,在浏览器中运行程序后,出现上面的错误. 转自:http://www.xuejiehome.com/blread-1828.html I'm experiencing 502 gate ...

  8. connect() failed (111: Connection refused) while connecting to upstream, cli

    php-fpm没有运行 执行如下命令查看是否启动了php-fpm,如果没有则启动你的php-fpm即可 netstat -ant | grep 9000 没有运行为空,有运行显示 tcp 0 0 12 ...

  9. connect() failed (111: Connection refused) while connecting to upstream的解决

    遇到这种情况, 首先 1.检查php-fpm是否启动---------如果没启动->启动, 2.用命令 netstat -ant | grep 9000 查看php-fpm进程,如果没启动-&g ...

随机推荐

  1. golang初识3 - func

    1. 功能块(function block) 格式: func function_name( [parameter list] ) [return_types] { //body } 与delphi的 ...

  2. CUDA编程模型——组织并行线程3 (2D grid 1D block)

    当使用一个包含一维块的二维网格时,每个线程都只关注一个数据元素并且网格的第二个维数等于ny,如下图所示: 这可以看作是含有二维块的二维网格的特殊情况,其中块儿的第二个维数是1.因此,从块儿和线程索引到 ...

  3. dax学习

    增长率 = (DIVIDE(SUM('业绩达成'[实际业绩]),CALCULATE(SUM('业绩达成'[实际业绩]),PREVIOUSMONTH('业绩达成'[周期])))-1)*100上月业绩 = ...

  4. python3下同时取得exe、zip和chm下载地址

    from selenium import webdriverimport osimport timeimport re cur_path=os.getcwd() #得到程序的当前目录str_file= ...

  5. Python第4天

    主要内容: 数字(int) 字符串(replace/find/join/strip/startswith/split/upper/lower/format) 列表 append/extend/inse ...

  6. springboot问题总结

    前端使用jsp界面,但是jsp界面中引用的静态资源无论如何也加载不出来,弄一天了,哎 最后把pom文件里的jar全干掉,代码移除,就剩下登录界面,看css能不能进来,结果没问题, 然后看类里面的注解, ...

  7. Split CSV/TXT file

    void Main(){ var path = @"c:\sourceGit\speciesLatLon.txt"; var inputLines = File.ReadAllLi ...

  8. HTML5 汉字转化为拼音,带读声,穷举多音字

    1,没别的,像这种没有规则的转化,我们首先需要一个字典文件,字典文件的完整度,决定了转化的成功率与精确度 2,笔者收集了较为完整的字典文件,已上传到博客园,欢迎补充  =>  https://b ...

  9. ASP.NET 实现PDF文件下载[转]

    本文介绍了一种在ASP.NET中下载文件的方法.方法一:可能是最简单的.最短的方式: 1 Response.ContentType = "application/pdf"; 2 R ...

  10. 关于web前端base64转换为Blob,存入数组后 ajax请求传输到后端 接受不到文件问题

    前端console输出是正常Blob对象,通过ajax formdata 传输到 后端java SpringMvc用MultipartFile接受却一直接受不到,后来直接解析HttpServletRe ...