问题描述

今天本打算学一下Nginx反向代理发送请求到OpenResty(其实也就是个Nginx,可以把它理解成Anaconda中的python版本),再通过OpenResty使用Lua脚本向Redis或数据库查找缓存来着,在配环境的时候报了个502错误。
我把我的环境描述下,这样如果有遇到这个问题的兄弟可以解决下。
前端页面通过Nginx托管,运行在windows上,OpenResty集群运行在虚拟机上(Centos),本地的Nginx仅仅起到动静分离和反向代理的作用,真正处理缓存的都会发送请求到OpenResty集群来处理。下面分别给出我在Win上的Nginx配置和OpenResty的配置图以及其他的环境描述。

  1. 本地Win上的Nginx配置
  2. 虚拟机Centos的OpenResty配置
  3. Lua脚本
  4. 前端页面(这里只要关注axios请求)

好了,环境就这样,然后现在在浏览器输入URL:http://localhost/item.html?id=10001
那它应该在页面返回我在Lua脚本中写的json内容,比如48寸什么的,但是回车之后毛都没有,页面数据没有变化,F12控制台报错axios 502 Bad Gateway。然后win的Nginx的日志文件中看到了这个:

我起初以为是防火墙把80端口挡住了,弄了半天没解决掉。

解决

但是我后来把win的Nginx监听端口改成8080,OpenResty的配置没变,居然可以成功请求到资源。
后来我发现它奶奶个孙子怎么已经有个Nginx把80给监听了,怪不得报错。把这个进程杀死,把Nginx配置改成80,完美运行。

Nginx配置错误:connect() failed (10061: No connection could be made because the target machine actively相关推荐

  1. connect() failed (10061: No connection could be made because the target machine actively refused it

    nginx运行web前端项目的时候出现了以下错误 项目在加载保存的图片的过程中,报错了,看了一下Nginx的错误日志 日志出现了connect() failed (10061: No connecti ...

  2. nginx connect()错误(10061: No connection could be made because the target machine actively refused it)

    nginx偶尔会报下面这个错误: 2019/05/20 10:54:56 [error] 717920#661892: *16943633 connect() failed (10061: No co ...

  3. 【无标题】nginx 502 解决 No connection could be made because the target machine actively refused it

    win11 已经搭建好的环境突然全部nginx502,127.0.01拒绝访问 nginx日志如下 无法连接fastcgi9000端口 connect() failed (10061: No conn ...

  4. Redis错误:No connection could be made because the target machine actively refused it

    问题: 利用go连接远程阿里云centos主机的redis,代码如下: redisCli := redis.NewClient(&redis.Options{Addr: url,Passwor ...

  5. consul注册报错 connectex: No connection could be made because the target machine actively refused it.

    consul注册报错 connectex: No connection could be made because the target machine actively refused it. Ge ...

  6. 关于docker报错:No connection could be made because the target machine actively refused it.

    我是在win10下跑的docker 事情是这样的,今天安装好douker跑起来后报了一个很奇怪的错误` C:\Users\Administrator>docker ps error during ...

  7. connectex: No connection could be made because the target machine actively refused it.

    关于阿里云服务器出现以下错误的原因: connectex: No connection could be made because the target machine actively refuse ...

  8. No connection could be made because the target machine actively refused it [::1]:808

    No connection could be made because the target machine actively refused it [::1]:808 1.首先查看端口占用情况, 在 ...

  9. VS Test: No connection could be made because the target machine actively refused it 127.0.0.1:6910

    问题: 在做web测试和负载测试时,突然所有的测试有例都不能用了.显示错误:No connection could be made because the target machine activel ...

  10. No connection could be made because the target machine actively refused it 127.0.0.1:8888

    No connection could be made because the target machine actively refused it 127.0.0.1:8888 你妹的微软 用的Wi ...

最新文章

  1. Maya初学者完整的3D动画大师班视频教程
  2. 10个必知必会的PyCharm使用技巧!
  3. sql server 2008语言基础: 集合
  4. HDU1081 (最大连续子序列/矩阵)
  5. php偷取,PHP偷取UTF-8目标网页内容输出为空白
  6. 苹果宣布将把语音助手Siri整合到Apple Music服务中
  7. 培养创造性思维的20个技巧
  8. 关于jquery基本过滤器中:eq()无法传变量的问题
  9. Java中常见流的分类及简单讲解
  10. iOS开发UIAlertController之UIAlertAction加图片(UIAlertController按钮加图片)
  11. 计算机组成与设计概念总结
  12. 详细解析Photoshop10个必学的抠图技巧
  13. 阿里云ECS搭建在线IDE
  14. UIdemo 制作一个简单的iPhone相册
  15. C++ Combo Box控件用法
  16. 空间统计分析学习笔记
  17. 谷歌中一些十分有趣的特效现象
  18. 在德国观看中文视频的免费网站总结--涵盖几乎中文各类所有视频
  19. Web前端html5+css3前端开发入门学习笔记
  20. 分段线性映射PWLCM的李雅普诺夫指数Lyapunov的matlab实现

热门文章

  1. 小学计算机学打字教学教案,小学信息技术优秀教案打字教学.docx
  2. DDPM代码详细解读(2):Unet结构、正向和逆向过程、IS和FID测试、EMA优化
  3. 学校计算机自培方案,2021年-2021年度下学期教师自培工作总结
  4. 从Native到Web(一), NaCl学习笔记: 环境搭建
  5. Aandroid调用摄像头拍照和从相册选择照片
  6. ubuntu18.04的PCL安装和配置
  7. 西门子产线整周实训总结(工位二) 2021-01-14
  8. python中判断真子集的符号_算法之--字符串包含【python实现】
  9. 解决宝塔面板Pure-Ftpd服务, FileZilla连接阿里云服务器时“服务器发回了不可路由的地址,使用服务器地址代替。”问题
  10. 带你看看JS的新趋势「State of JS 2020」中文解读