nginx 解决 connect() failed (111: Connection refused) while connecting to upstream,
嗯哼,刚装了个ubuntu的lnmp,我的天啊,踩的坑比我脂肪还多了
比如刚装完的时候访问显示502,

也不知道什么问题,就去看了一下nginx日志 /var/log/nginx/error.log,发现了这个错误
2018/06/03 13:38:23 [error] 21332#21332: *301 connect() failed (111: Connection refused) while connecting to upstream, client: 115.159.183.71, server: 202.182.116.84, request: "GET /phpmyadmin/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "202.182.116.84"
去搜了一下,这样的错误有两个解决方式
1.php-fpm没有运行
执行如下命令查看是否启动了php-fpm,如果没有则启动你的php-fpm即可
netstat -ant | grep
2.php-fpm队列满了
php-fpm.conf(/etc/php/7.0/fpm/php-fpm.conf)配置文件pm.max_children修改大一点,重启php-fpm并观察日志情况
呵呵,但是呢,姐姐岂止是普通人,这两个都看了还是不行,解决完了才发现,没想到啊,自己竟然有一个这么大的错误
来啊从配置文件开始看起吧,
3、修改配置文件
因为nginx和php有两种链接方式,一种是
fastcgi_pass 127.0.0.1:9000;
另一种是这个
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
这个具体怎么用要去php fpm里面去看他的配置文件
/etc/php/7.0/fpm/pool.d/www.conf里面的Listen
如果Listen是端口就写127.0.0.1:9000;
如果是路径,nginx的配置文件也要学路径,unix:/run/php/php7.0-fpm.sock;

重新访问就好了

所以说修改一下配置文件,在重启一下nginx,就好了。其实按理说不能发生这种事的,但是呢?自己搭的时候,几乎所有的事都有可能发生。记录下来,以防再次入坑。
nginx 解决 connect() failed (111: Connection refused) while connecting to upstream,的更多相关文章
- 解决connect() failed (111: Connection refused) while connecting to upstream
使用nginx时, 有可能遇到connect() failed (111: Connection refused) while connecting to upstream的问题. 如果upstrea ...
- Nginx报错 connect() failed (111: Connection refused) while connecting to upstream 的解决方法
今天访问公司的网站突然报错,抛出一些英文,提示看一下Nginx的error.log日志: cd /usr/local/nginx/logs/ 看到了error.log ,下一步 tail -n 2 ...
- [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 ...
- nginx访问502 gateway,*1 connect() failed (111: Connection refused) while connecting to upstream
安装好nginx,php环境后,配置虚拟主机,结果访问后就报502 gateway,查看日志文件后,显示错误如下: 2019/04/29 16:24:39 [error] 19433#19433: * ...
- nginx 报错 connect() failed (111: Connection refused) while connecting to upstream
公司网站搬迁到新服务器后,发现站点访问不了,network里面提示502,查看相关的server配置,感觉没有什么问题,经过测试发现txt.html.等非php文件能够直接访问,也就是php访问不了, ...
- connect() failed (111: Connection refused) while connecting to upstream
配置好lamp后,在浏览器中运行程序后,出现上面的错误. 转自:http://www.xuejiehome.com/blread-1828.html I'm experiencing 502 gate ...
- 配置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 ...
- connect() failed (111: Connection refused) while connecting to upstream的解决
遇到这种情况, 首先 1.检查php-fpm是否启动---------如果没启动->启动, 2.用命令 netstat -ant | grep 9000 查看php-fpm进程,如果没启动-&g ...
- connect() failed (111: Connection refused) while connecting to upstream报错处理
新lnmp环境调试项目时,nginx报错如下: 解决: 发现php-fpm.conf是以套接字方式通信,而nginx是以端口方式通信,见下图: 将nginx.conf修改为如下,重新reload即可
随机推荐
- Codeforces Round #601 (Div. 2) B Fridge Lockers
//题目要求的是每一个点最少要有两条边连接,所以可以先构成一个环.然后再把剩余的最短的边连接起来 #include<iostream> #include<algorithm> ...
- error C2825: '_Iter': 当后面跟“::”时必须为类或命名空间 -- 原因可能是参数错误或者自定义函数名和库函数名冲突
今天运行程序的时候遇到了下面这个bug > B1020.cpp >e:\vs2013\vs2013_rtm_ult_chs\data\vc\include\xutility(): erro ...
- CentOS7下升级PHP版本为7.2
yum provides php #自带的只有5.4版本 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm #更新源 rpm ...
- 解决报错Failed to start LSB: Bring up/down networking:MAC地址导致
1.场景描述,我在电脑里装好的虚拟机,今天突然就网络无法打开,并出现如下报错: [root@ansible-control ~]# systemctl start networkJob for net ...
- cookies、sessionStorage和localStorage的异同点
相同点:都是存储于客户端 不同点: 1.存储大小 cookies数据大小不能大于4k; localStorage和sessionStroage则可以达到5M: 2.有效时间 cookies在设置的有效 ...
- Python之旅第二天(第一天补充部分、数据类型、运算逻辑、部分方法的引入、pycharm)
今天其实是有点小忙的,但是干自己不喜欢事情的结果就是,要睡觉了都不知道自己在忙鸡毛,所以还是不继续想了,脑仁疼.回忆一下今天的学习内容,着实有点少,本大侠还没怎么过瘾呢.废话不多说. while补充两 ...
- C#的HttpModule中及Java的Servlet中成员变量乱用导致的不易重现的BUG
3年前写的在HttpModule中记录访问日志的代码,在最近使用日志数据分析登录账号的IP情况时,才发现了一个不易重现的BUG——日志中记录的登录账号出现串掉的情况.之所以这个时候才发现该问题,是因为 ...
- unity的一些特殊目录
Hidden Folders Folders that start with a dot (e.g. ".UnitTests/", ".svn/") are i ...
- 经常犯的错误之递归写不全return
在写递归函数的时候,只在最后一层写return,中间的过程没有return,导致结果的丢失. 举个例子 LL query(LL i, LL k) { if (sum[i] < k) { ; } ...
- numpy广播机制,取特定行、特定列的元素 的高级索引取法
numpy广播机制,取特定行.特定列的元素 的高级索引取法 enter description here enter description here