【故障】nginx间隙性出现502 错误,linux学习ppt
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - remoteuser[remote_user [remoteuser[time_local] “$request” ’
'$status bodybytessent"body_bytes_sent "bodybytessent"http_referer" ’
‘“httpuseragent""http_user_agent" "httpuseragent""http_x_forwarded_for”’;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8091;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
proxy_set_header Host host:host:host:server_port;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.1.61:9199/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
在测试环境访问,相同的配置没有问题,但是放到正式环境就会出现间隙性访问502的错误。
问题定位
===================================================================
查看nginx 错误日志。
2020/08/07 09:29:22 [crit] 12236#11116: *457 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *458 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *460 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *462 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *464 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *466 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *468 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *470 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *472 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *474 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *476 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *478 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *480 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: "GET / HTTP/
《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》
【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享
1.1", upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *482 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *484 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *486 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *488 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *490 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *494 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *495 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:22 [crit] 12236#11116: *497 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
2020/08/07 09:29:59 [crit] 12236#11116: *490 connect() to 172.18.44.6:8091 failed (10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full) while connecting to upstream, client: 183.17.229.173, server: localhost, request: “GET / HTTP/1.1”, upstream: “http://172.18.44.6:8091/”, host: “183.207.215.123:8091”
都是报错:
10055: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
翻译过来的意思就是:套接字上的操作无法执行,因为系统缺少足够的缓冲区空间或队列已满。
意思是说缓存满了,这个更像是服务器的问题。
网上百度了一圈,也没有找到很好的解决方案。
查看端口也没有很多的等待队列。
netstat -ano |findstr “8091”
但是既然是报这种错,系统缺少足够的缓冲区空间。就先从这个错误入手。
在nginx 中设置代理的缓存。
proxy_buffering on; #开启从后端被代理服务器的响应内容缓冲
proxy_buffer_size 4k; #设置从后端被代理服务器的响应内容缓冲区大小
proxy_buffers 8 1M; #设置从被代理的后端服务器取得的响应内容缓冲区的大小和数量
proxy_busy_buffers_size 2M; #高负荷下缓冲大小(proxy_buffers*2)
解决方案
===================================================================
暂时的解决方案,在nginx.conf 中增加代理缓存的配置。
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
【故障】nginx间隙性出现502 错误,linux学习ppt相关推荐
- 【故障】nginx间隙性出现502 错误
#pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type app ...
- Linux下使用Nginx端口转发出现502错误的一种解决办法
今天圈里的一个朋友在配置完nfinx80端口转发到5000后,发现一个问题 问题描述: 正确配置了Nginx80端口转5000端口,在CentOS上把.Net core WebAPI站点上传到cent ...
- php 502.88,Nginx+PHP-FPM 访问出现 502错误
游戏后端代码采用Nginx+PHP-FPM的方式部署.放问游戏的时候偶尔会出现502错误. Nginx错误日志出现以下日志 2014/07/05 17:20:58 [error] 18431#0: * ...
- 详解php+nginx 服务发生500 502错误排查思路
https://www.jb51.net/article/165775.htm 利用strace追踪php-fpm多个进程: https://blog.csdn.net/fantexi1984/art ...
- nginx 502错误原因和解决办法总结
nginx 502错误原因和解决办法总结 一.NGINX 502错误排查 二.Nginx 413错误的排查:修改上传文件大小限制 三.Nginx 400错误排查:HTTP头/Cookie过大 一.NG ...
- Nginx 502错误原因和解决方法
一.NGINX 502错误排查 NGINX 502 Bad Gateway错误是FastCGI有问题,造成NGINX 502错误的可能性比较多.将网上找到的一些和502 Bad Gateway错误有关 ...
- php 502 bad gatway,Nginx php如何解决502 Bad Gateway错误
在Web服务器中有很多先进的技术,Nginx php就是其中的一个,接下来我们就看看在Nginx 中的相关问题解决,希望大家有所收获.Nginx php中配置php fastcgi组解决莫名其妙的50 ...
- java 502错误,Spring Boot连接超时导致502错误的实战案例
1.问题描述 内部系统之间通过Nginx来实现路由转发. 但最近发现有一个系统,经常报502错误,每天达到上百次,完全无法忍受. 2. 原因排查 于是进行排查, 发现配置人员把连接超时时间(serve ...
- java中502错误原因_Spring Boot连接超时导致502错误的实战案例
Spring Boot连接超时导致502错误的实战案例,错误,时间,客户端,站长站,原因 Spring Boot连接超时导致502错误的实战案例 易采站长站,站长之家为您整理了Spring Boot连 ...
最新文章
- 3Blue1Brown深度学习笔记 深度学习之神经网络的结构 Part 1 ver 2.0
- 433M无线串口E30-TTL-100在农业物联网上的应用
- C语言文件与数组之间输入输出操作
- Linux通过进程号查询占用的端口
- python kmeans聚类_python机器学习之k-means聚类算法(1)
- gitbash登录码云报错_手把手教你入门git仓库和关联码云
- 用C#完成Swift远程推送通知
- 和电商有关的词语_电商描写的词语 形容“电”的词语有哪些?
- 技能竞赛国赛_中西部第一!技能“川军”在第一届全国技能大赛斩获4金5银6铜...
- bootstrap 常用的导航组件
- Bolt界面引擎中XLUE布局XML文件节点属性配置详解
- 某热门单击手游lua解密.md
- WebKit的默认样式
- DMA驱动框架流程编写
- 个人先进事迹如何写--注意三个关键词的把握
- dns服务器不可用了怎么修复,dns服务器可能不可用怎么解决(dns服务器最有效的解决方法)...
- php1064,PHP创建表错误1064
- C语言单目运算符和双目运算符、三目运算符
- Openstack Neutron 集成 SDN控制器
- Cesium学习笔记--Sandcastle is not defined
热门文章
- office 2016 for Mac打开时 出现隐藏模块中出现编译错误: link
- 一卡通变“一脸通”,人脸识别让校园更安全
- CSS实现背景图片透明文字不透明效果的两种方法
- Java异常处理最佳实践及陷阱防范
- python绘制直线的垂线_Matplotlib:散点图中的垂直线
- 转----一个图形爱好者的书架.-也来介绍一下我的藏书.
- 自从用了这款黑科技工具,妈妈再也不用担心我的c盘文件爆满了
- 工作室多wifi软路由工作室Ros软路由使用教程
- 人工智能(AI)在未来的发展趋势和应用场景
- v-model的radio checkbox以及键盘修饰符使用