今天公司某运营系统某接口出现502 Bad Gateway异常.

解决问题思路:去服务器查看nginx异常日志,查找nginx异常日志分析问题

1.使用sudo nginx -t查看nginx配置文件位置

ais-di@parrot:/etc/nginx$ sudo nginx -t
[sudo] password for ais-di:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

2.查看nginx.conf配置文件查找其异常日志存在的位置::

ais-di@parrot:/etc/nginx$ cat /etc/nginx/nginx.conf | grep error.logerror_log /var/log/nginx/error.log;

3.查看异常日志文件,找到自己主机的请求

ais-di@parrot:/etc/nginx$ sudo cat /var/log/nginx/error.log | grep 10.25.8.103
2022/04/19 10:32:24 [error] 893#893: *7554500 connect() failed (111: Connection refused) while connecting to upstream, client: 10.25.8.103, server: marsops.i-tetris.com, request: "GET /api/nlu/sp/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_esp_function_on_20220417 HTTP/1.1", upstream: "http://10.86.11.38:8877/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_esp_function_on_20220417", host: "ais.i-tetris.com:9890", referrer: "http://ais.i-tetris.com:9890/"
2022/04/19 10:32:27 [error] 893#893: *7554507 connect() failed (111: Connection refused) while connecting to upstream, client: 10.25.8.103, server: marsops.i-tetris.com, request: "GET /api/nlu/sp/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_esp_function_on_20220417 HTTP/1.1", upstream: "http://10.86.11.38:8877/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_esp_function_on_20220417", host: "ais.i-tetris.com:9890", referrer: "http://ais.i-tetris.com:9890/"
2022/04/19 10:43:33 [error] 893#893: *7554621 connect() failed (111: Connection refused) while connecting to upstream, client: 10.25.8.103, server: marsops.i-tetris.com, request: "GET /api/nlu/sp/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_auto_emergency_braking_on_20220417 HTTP/1.1", upstream: "http://10.86.11.38:8877/wa/single_pre_annotation?table=expr_model_inbox&setName=Abasic_kaidi_jiaqi_auto_emergency_braking_on_20220417", host: "ais.i-tetris.com:9890", referrer: "http://ais.i-tetris.com:9890/"

4.去查看配置文件查看该服务是否正常启动
当查看nginx.conf文件时,并没有发现server块,是因为其被include在了其他的配置文件中,nginx支持多文件配置找到相应的文件,去查看该服务请求的端口

server {listen 9890;root /var/www/html/nlu;index index.php index.html index.htm index.nginx-debian.html;server_name marsops.i-tetris.com;client_max_body_size 100M;location / {try_files $uri $uri/ =404;}location /api/nlu/review/ {proxy_set_header   X-Real-IP $remote_addr;proxy_set_header   Host      $http_host;proxy_http_version 1.1;proxy_set_header Connection "";proxy_connect_timeout       300;proxy_send_timeout          300;proxy_read_timeout          300;send_timeout                300;proxy_pass http://127.0.0.1:20731/;}location /api/nlu/sp/ {proxy_set_header   X-Real-IP $remote_addr;proxy_set_header   Host      $http_host;proxy_http_version 1.1;proxy_set_header Connection "";proxy_connect_timeout       300;proxy_send_timeout          300;proxy_read_timeout          300;send_timeout                300;proxy_pass http://10.86.11.38:8877/;}
}

请求的接口前缀就是“/api/nlu/sp/”,发现实质是请求10.86.11.38:8877服务,而登录到该服务器上发现该服务未启动。启动即解决问题

工作日志:502 Bad Gateway异常分析相关推荐

  1. EasyPlayer播放器出错502 Bad Gateway问题分析

    EasyPlayer播放器系列项目可以说是目前市面中一款非常开放的播放器项目,用户可以根据自己的需求调用接口或者进行开发,实用性强,稳定性也足够优越. 今天遇到一个用户咨询EasyPlayer播放器的 ...

  2. nginx 返回 502 Bad Gateway

    问题描述: nginx 返回502 Bad Gateway 原因分析: 查看nginx错误日志大量 upstream timed out (110: Connection timed out) 排查后 ...

  3. 【连载】高效人士的116个IT秘诀(第2版)——秘诀25快速记录你的工作日志

    上一篇:[连载]高效人士的116个IT秘诀(第2版)--秘诀24为你的时间建一个构造图 等级--初级 平台--全部 成本--免费 一直记录自己所做的事情实际花费了多少时间并不是一件容易的事,但工作日志 ...

  4. 服务器出现 nginx 502 Bad Gateway

    发生原因1.PHP FastCGI进程数不够用 当网站并发访问巨大时,php fastcgi的进程数不有一定的保障,因为cgi是单线程多进程工作的,也就是说cgi需要处理完一个页面后再继续下一个页面. ...

  5. AD19 add pins to nets错误_NGINX 502 Bad Gateway错误疑难解答

    502 Bad Gateway错误非常常见,此错误代码的确切原因取决于您的特定堆栈. 由于前端Web服务器和后端应用程序处理程序之间的通信中断,通常会出现错误的网关错误.大多数情况下,潜在原因可归因于 ...

  6. legend3---Homestead中Laravel项目502 Bad Gateway

    legend3---Homestead中Laravel项目502 Bad Gateway 一.总结 一句话总结: 用查看错误日志的方法解决错误:(/var/log/nginx/.log) 1.home ...

  7. 工作日志之个人统计篇

    前面的工作日志分享篇中我们详细介绍了如何将开发人员的工作信息分享给自己的主管和团队中的其他人.一般来说,研发工作者了解他们的工作状况时,通常并不会过多的去关注每一个研发工作的细节,而往往更加需要关注的 ...

  8. NGINX 502 Bad Gateway 用upstream解决方法

    一般nginx搭配php都采用这样的方式: location ~ \.php$ {     proxy_pass http://localhost:9000;     fastcgi_param SC ...

  9. nginx 502 Bad Gateway解决办法

    我的解决方式比较小白, 第一次报这个错(nginx 502 Bad Gateway).网上找了一大圈都是PHP什么的,但是好像都不适用. 于是问了之前的一个同事,他说是不是我的tomcat关闭了,我恍 ...

最新文章

  1. 干货 | 《利用Python进行数据分析》资料开源下载
  2. Facebook暂停中国工具类应用广告
  3. 初创公司MongoDB最佳实践策略和躲坑秘笈
  4. BeautfuiSoup4解析器
  5. c++局部对象是什么_小白学Web前端难点是什么 JS进阶知识点有哪些
  6. 亚马逊提出无监督虚拟增强句子表征学习框架,效果超越SimCSE
  7. dev 命令行参数调用_云开发·云调用生成小程序码
  8. 郑杰 | 如何拿回我们自己的医疗数据?
  9. 消息称谷歌Pixel系列手机默认禁用美颜功能
  10. OpenCV---高斯模糊(均值模糊的另一种)
  11. 函数返回值是否使用引用类型的问题:理解引用、返回值
  12. 感悟 | 一个 33 岁老程序员的自白:因为那时候我还不懂得…
  13. linux操作系统的中断处理,Linux操作系统内核编程中断处理程序解读
  14. CodeGear 出品 Delphi for PHP
  15. 开博第一篇:一个关于正则表达式相关的问题
  16. 2020年中国养老地产行业市场现状分析,提高养老地产运营水平是关键「图」
  17. jquery+cropper剪切、旋转、缩放图片
  18. [copypaste]各种表示法
  19. 【samba】Wodows同步Linux文件|搭建共享文件服务器——在windows上映射网络驱动器...
  20. NPOI导出EXCEL 合并单元格、统计列、单元格样式设置

热门文章

  1. Python最简单的文字游戏——数字炸弹
  2. Win10更改用户名
  3. OpenGL超级宝典第7版环境配置
  4. 计算机网络实验:实验三 路由器的基本配置
  5. vscode中!无法生成模板解决方案
  6. 比亚迪“亮刀”、宁德时代“狂奔”,动力电池市场的巨头混战几时休?
  7. 在嵌入式板子ARMv7 上利用neon对彩色图转换为灰度图进行加速
  8. chipmunk物理引擎的基本概念和基本用法
  9. IP/TCP协议详解
  10. 输出电容的ESR对DC_DC的影响——电感发烫排查思路