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 ...
随机推荐
- 为什么你不应该用angularjs?
AngularJS的问题 为什么你不该用angularjs,https://medium.com/@mnemon1ck/why-you-should-not-use-angularjs-1df5ddf ...
- hdfs创建级联文件夹
一个文件夹 hdfs dfs -mkdir /out /一定要有 级联 hdfs dfs -mkdir -p /out/ags 需要家-p
- Hash_P1026毒药?解药?
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> ...
- cmd执行命令返回执行信息
/// <summary> /// 执行CMD语句 /// </summary> /// <param name="cmd">要执行的CMD命令 ...
- JQuery实现页面刷新滚动条自动滚动到特定位置
var cotentOffset = $('#6f').offset(); $('.info_box').animate({ scrollLeft: cotentOffset.left }, ); 原 ...
- fstream使用简介
fstream用来进行输入/输出文件的操作. fstream file1; 定义了fstream类的一个对象file1file1.open("filename",...) 打开名为 ...
- pythong中字符串strip的用法
strip的用法是去除字符串中前后两端的xx字符,xx是一个字符数组,并不是去掉“”中的字符串, 数组中包含的字符都要在字符串中去除.默认去掉空格,lstrip则是去掉左边的,rstrip是右边的 见 ...
- vi编辑文件出现Can't open file for writing错误
可以用 ll 命令查看一下文件的权限,很有可能是没有权限,用chmod命令修改一下权限就可以了(当然是文件所有者或者root用户才能修改),或者切换成root用户(不推荐)
- Code笔记之:CSS+HTML display 属性
display属性值:none 此元素不会被显示. block 此元素将显示为块级元素,此元素前后会带有换行符. inline 默认.此元素会被显示为内联元素,元素前后没有换行符. inline-bl ...
- Beta版本——第一次冲刺博客
我说的都队 031402304 陈燊 031402342 许玲玲 031402337 胡心颖 03140241 王婷婷 031402203 陈齐民 031402209 黄伟炜 031402233 郑扬 ...