connect() failed (111: Connection refused) while connecting to upstream
配置好lamp后,在浏览器中运行程序后,出现上面的错误。
转自:http://www.xuejiehome.com/blread-1828.html
I'm experiencing 502 gateway errors when accessing a PHP file in a directory (http://domain.com/dev/index.php), the logs simply says this:
// :: [error] #: * connect() failed (: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: \"GET /dev/ HTTP/1.1\", upstream: \"fastcgi://127.0.0.1:9000\", host: \"domain.com\"
The answer:
It sounds like you haven't started and configured backend for Nginx. Start php-fpm and add the following to nginx.conf, in http context:
server {
listen 127.0.0.1;
server_name localhost;
error_log /var/log/nginx/localhost.error_log info;
root /usr/local/nginx/html;
location ~ \\.php$ {
root html;#此处和server下面root保持一致,默认为html
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
}
大概意思是你没有启动或者配置php-fpm.其中“/usr/local/nginx/html”为网站根目录。
而我刚好是没有启动php-fpm,在终端运行“service php-fpm start”;
ok,正常运行了。
connect() failed (111: Connection refused) while connecting to upstream的更多相关文章
- [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 ...
- 解决connect() failed (111: Connection refused) while connecting to upstream
使用nginx时, 有可能遇到connect() failed (111: Connection refused) while connecting to upstream的问题. 如果upstrea ...
- 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访问不了, ...
- 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,
嗯哼,刚装了个ubuntu的lnmp,我的天啊,踩的坑比我脂肪还多了 比如刚装完的时候访问显示502, 也不知道什么问题,就去看了一下nginx日志 /var/log/nginx/error.log ...
- 配置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, cli
php-fpm没有运行 执行如下命令查看是否启动了php-fpm,如果没有则启动你的php-fpm即可 netstat -ant | grep 9000 没有运行为空,有运行显示 tcp 0 0 12 ...
- connect() failed (111: Connection refused) while connecting to upstream的解决
遇到这种情况, 首先 1.检查php-fpm是否启动---------如果没启动->启动, 2.用命令 netstat -ant | grep 9000 查看php-fpm进程,如果没启动-&g ...
随机推荐
- O(nlogn)LIS及LCS算法
morestep学长出题,考验我们,第二题裸题但是数据范围令人无奈,考试失利之后,刻意去学习了下优化的算法 一.O(nlogn)的LIS(最长上升子序列) 设当前已经求出的最长上升子序列长度为len. ...
- 【bzoj1911】 Apio2010—特别行动队
http://www.lydsy.com/JudgeOnline/problem.php?id=1911 (题目链接) 题意 给出一个序列,将序列分成连续的几段,每段的价值为a*s*s+b*s+c,其 ...
- 【vijos1243】 生产产品
https://vijos.org/p/1243 (题目链接) 题意 一个产品的生产有m个步骤,一共n个机器人.机器人i完成步骤j的时间为T[i][j],每次当产品从一个机器人那里移动到另一个机器人那 ...
- poj3335 半平面交
题意:给出一多边形.判断多边形是否存在一点,使得多边形边界上的所有点都能看见该点. sol:在纸上随手画画就可以找出规律:按逆时针顺序连接所有点.然后找出这些line的半平面交. 题中给出的点已经按顺 ...
- 文件内容统计——Linux wc命令
有了该命令,就可以得到当前目录下所有符合条件的文件总数,如下: find -type f | wc -l 这个命令的功能也很好记,因为它功能很有限: wc -c filename:显示一个文件的字节数 ...
- squid清除缓存
客户经常要求清除缓存 由于CDN后台只能支持单个url的 所以目录级别的只能用脚本 example:清除 www.123.com 下所以的缓存 #!/bin/bash TODAY=`date +%Y ...
- jpa和hibernate注解
http://www.objectdb.com/api/java/jpa/JoinColumns 用hibernate和jpa annotation 大概一年多了,今天闲来无事,对他们关联关系元数据写 ...
- RNN 入门教程 Part 3 – 介绍 BPTT 算法和梯度消失问题
转载 - Recurrent Neural Networks Tutorial, Part 3 – Backpropagation Through Time and Vanishing Gradien ...
- 高可用与负载均衡(6)之聊聊LVS的三种模式
LVS的赘述 IPVS,ipvs ,ip_vs是负载均衡器中的内核代码 LVS是完整的负载均衡器+后端服务器.这些组件组成了虚拟服务器. LVS是一个4层负载均衡方案,标准的客户端-服务器网络语义也被 ...
- the setting of serial port in the SecureCRT
set echo(display characters which are sent) Line wrap : press 'enter' to send '\r'(0x0D), go ...