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

报错

Nginx代理Vue项目,访问基于Flask搭建的后台时,一直报出访问路径错误。查看Nginx错误日志,发现报错是connect() failed (111: Connection refused) while connecting to upstream

$ cat /var/log/nginx/error.log2022/04/26 17:46:26 [error] 1593845#1593845: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.110.245, server: , request: "POST /api/user/login/ HTTP/1.1", upstream: "http://127.0.0.1:5000//user/login/", host: "192.168.110.228", referrer: "http://192.168.110.228/"

原因

原因是在安装flask的时候,使用时是apt安装的,而不是pip3进行安装的。

$ sudo apt install python3-flask $ flask run -h 0.0.0.0 -p 5000

解决方案

卸载掉python3-flask

$ sudo apt remove python3-flask

使用pip3安装flask

$ pip3 install flaskWARNING: The script flask is installed in '/data2/jing.w/.local/bin' which is not on PATH.Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.# 如果安装flask之后, 路径不在Path中, 使用软链接
$ sudo ln -s /data2/jing.w/.local/bin/flask /usr/bin/flask

connect() failed (111 Connection refused) while connecting to upstream相关推荐

  1. An error occurred. connect() failed (111: Connection refused) while connecting to upstream

    今天早上来忽然线上所有图片都打不开了(实在忒恐怖),打开图片URL发现下图↓ 这顶上告诉我们看error log  那么就去nginx的服务器上看error.log文件,发现总是报下面的错误↓ 网上如 ...

  2. 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: * ...

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

    今天修改nginx的时候遇到这个问题 页面刷新一直报502错误 最后发现是修改nginx配置的时候, 有的个地方配置错了 报错原文: 19644#19644: *8 connect() failed ...

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

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

  5. socketio连接失败,nginx返回502 connect failed (111: Connection refused)问题解决

    问题现象 我们的信控平台,需要实时展示交通信号机的实时灯态(红黄绿.通行进口流向.倒计时等) 现在的信号机,大多都支持国标2007协议或者2017协议,来实现硬件设备与其他平台的通信,主要是通过soc ...

  6. Linux配置Nginx与PHP-FPM出现[error] 80143#0: *1 connect() failed (111: Connection refused) while connectin

    原因是只启动了nginx 没有启动php-fpm /usr/local/sbin/php-fpm [root@localhost ~]# ps aux | grep 'php-fpm' root 80 ...

  7. nginx报错解决connect() to unix:/tmp/php-cgi-73.sock failed (111: Connection refused

    2020/06/09 08:50:16 [error] 6608#0: *1 connect() to unix:/tmp/php-cgi-73.sock failed (111: Connectio ...

  8. Android --- 怎么样在布局中显示服务器的图片,或者是后台项目中的图片+connect failed: ECONNREFUSED (Connection refused)问题的解决(文章最后)

    今天在写Android项目的时候遇到这样一个问题,我已经从后台SpringBoot中拿到了图片id,但是要怎么样显示到AS端呢? 首先看到了网上有用Glide的,我在这里整理一下简单明了的操作步骤 1 ...

  9. 【nginx】kevent() reported that connect() failed (61: Connection refused)

    本文转自:http://www.sjsjw.com/kf_system/article/026756ABA000352.asp 首先确认你的相关服务是否启动了(php-fpm ); ps:如果你的启动 ...

最新文章

  1. 日志分析,seci-log1.03增加了web日志分析,新增了多种告警
  2. 微软:Visual Studio2010能驱动世界
  3. 我看西电通院月考——学生应该做点什么?
  4. 红橙Darren视频笔记 筛选View 属性动画 Adapter模式 组合动画AnimatorSet 观察者模式(对比Android ListView) 练习
  5. Java编译器调试不了_使用Maven设置Java编译器的-source和-target-不起作用
  6. 吉林省职称2017计算机免试,[吉林省职称评定条件]吉林省调整职称评审政策:这些人员可免试外语.doc...
  7. centos7.6 LNMP新版本
  8. git 更换密码后,pull代码 fatal: Authentication failed for '
  9. 《监控》其实是讲一个年轻人彻底社会化的过程
  10. 开源工业物联网数据库 Apache IoTDB 毕业成为 Apache 顶级项目!
  11. 计算机主机有自带的声音吗,Windows XP 系统中没有音频设备,怎么办?
  12. opnet安装的问题
  13. BUUCTF刷题记录(持续更新中~)
  14. LeetCode刷题时遇到error: control reaches end of non-void function [-Werror=return-type]的解决方法
  15. 基于python实现FFT和DWT记录
  16. 滑动时固定在头部的一部分会变色(向下滑会变红)
  17. Python 二分法求多项式单根
  18. 省市县数十万数据集PM2.5面板数据(更新至2020年)
  19. UE4 Geometry Polygon
  20. 【官方推荐】微信小程序搜索优化指南

热门文章

  1. 开发了一款微信拜年小程序
  2. Android手机刷机介绍
  3. 目前主流的移动广告联盟有哪些呢?
  4. 为何电脑不识别iPhone
  5. 蓝牙耳机与电脑连接篇
  6. G3D游戏引擎——编译
  7. 证明:串联谐振回路中电容与电感两端电压的模值相等,且等于外加电压的Q倍
  8. java计算机毕业设计基于安卓Android的社交app-社会交友app
  9. 数据库查数据 索引
  10. 2022081班李亚楠20220902