nginx error: upstream prematurely closed connection while reading response header from upstream
环境描述
Nginx 版本 1.10.2
PHP 版本 7.0.12
Node 版本 5.9.0
本文是想讲一个 Nginx 的错误,为啥还要提及 PHP 和 Node 的版本呢?容我先还原一下应用场景
首先就是我有一个绑定在 3000 端口的 Node Server
我需要从 80 端口直接访问这个服务,所以我使用了 Nginx 的反向代理
而至于 PHP ,其实这个错误就是与它有关
查找错误原因
当我使用这个 Node Server 的时候,返回了一个 502 Bad Gateway 错误
查看网络请求,也没有什么错误,接着就查看了 Nginx error log 里的错误信息
[error] 17028#0: *111 upstream prematurely closed connection while reading response header from upstream
好吧,并不是什么明显的错误提示,只好到 Google 查查看了
查了一番似乎也挺多人遇到这个问题的,但是解决问题的方法好像都不一样。。。
有的说是 keepalive_timeout 值太小了 (这个值我根据服务配置,已经改成 600,感觉不太可能),还有说重启 Nginx 就行了 (尝试过。),等等。。。
当然也有让我眼前一亮的答案,那就是 重启 php-fpm ,果断尝试一下
果然。。。启动报错了,提示大概意思是端口被占用了,瞬间感觉好像找对了突破口
解决错误
看了一下端口才发现,原来是之前已经开启了另外一个 Node Server 占用了 php-fpm 默认的 9000 端口
简直是自己坑自己!
因为服务的端口不能改,要和其它同事的统一,所以我把 php-fpm 的端口改成了 9999
PHP 是使用 brew 安装的,配置路径为: /usr/local/etc/php/7.0/php-fpm.d/www.conf
listen = 127.0.0.1:9999
然后重启 php-fpm 就 OK 了
nginx error: upstream prematurely closed connection while reading response header from upstream的更多相关文章
- Nginx" upstream prematurely closed connection while reading response header from upstream"问题排查
问题背景 我们这边是一个基于Nginx的API网关(以下标记为A),最近两天有调用方反馈,偶尔会出现502错误,我们从Nginx的error日志里看,就会发现有" upstream prem ...
- upstream prematurely closed connection while reading response header from upstream
upstream prematurely closed connection while reading response header from upstream nginx配置uwsgi的时候 ...
- 解决flask的502错误:upstream prematurely closed connection while reading response header from upstream
我在使用 tiangolo/uwsgi-nginx-flask 部署flask应用的时候,经常运行一会儿就出现502错误,重新启动容器后,就恢复. 且经常会出现数据更新后,刷新结果不一致. docke ...
- nginx 超时问题: upstream timed out (110: Connection timed out) while reading response header from upstream
目录 错误内容 错误原因 错误解决办法 错误内容 我们可以在error.log 里面可以看到 错误内容:upstream timed out (110: Connection timed out) w ...
- nginx recv() failed (104: Connection reset by peer) while reading response header from upstream解决方法
首先说下 先看 按照ab 每秒请求的结果 看看 都有每秒能请求几个 如果并发量超出你请求的个数 会这样 所以一般图片和代码服务器最好分开 还有看看io瓶ding 和有没有延迟的PHP代码执行 0 先修 ...
- Nginx+PHP配置错误,日志:[error] 24324#0: *31 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
一.问题现象 1.安装nginx.php.php-fpm后,浏览器访问php报错,“File not found”: 二.问题排查 1.检查nginx.php-fpm服务是否正常启动,均正常启动: 2 ...
- recv() failed (104: Connection reset by peer) while reading response header from upstream
2017年12月1日10:18:34 情景描述: 浏览器执行了一会儿, 报500错误 运行环境: nginx + php-fpm nginx日志: recv() failed (104: Conn ...
- 修复Nginx 502错误:upstream sent too big header while reading response header from upstream
原文出处:https://www.cnblogs.com/jpfss/p/10237463.html 便于以后参考我复制了过来! cookies的值超出了范围我是说 看看了一下日志 错误502 ups ...
- upstream timed out (110: Connection timed out) while reading response header from upstream
Nginx报错日志有如下内容: upstream timed out (110: Connection timed out) while reading response header from up ...
随机推荐
- [翻译] FlatUIKit
FlatUIKit FlatUIKit is a collection of iOS components styled with the "Flat UI" aesthetic ...
- 如何高效把一字节的位对换, bit0和bit7,bit1和bit6,以此类推.
#include<stdio.h> #include<stdlib.h> //异或法 unsigned char byteReverse(unsigned char val) ...
- MapReduce任务分析与讨论MapReduce job explained
In the last post we saw how to run a MapReduce job on Hadoop. Now we're going to analyze how a MapRe ...
- javascript和python取dict字典对象的不同
dict1={"a":1,"b":2,"22a":44} JS: dict1.a 和 dict1["a"]都可以 pyt ...
- Android中怎样调用拨打电话?
Android系统原本就为手机设计,所以,在android系统中的不论什么App中,仅仅要愿意,拨打指定电话很方便. 核心就是使用Intent跳转,指定请求Action为Intent.ACTION_C ...
- flume 日志导入elasticsearch
Flume配置 . flume生成的数据结构 <span style="font-size:18px;">"_index" : "logs ...
- Spark Streaming的编程模型
Spark Streaming的编程和Spark的编程如出一辙,对于编程的理解也非常类似.对于Spark来说,编程就是对于RDD的操作:而对于Spark Streaming来说,就是对DStream的 ...
- Python在Windows下操作CH341DLL
#! /usr/bin/env python #coding=utf-8 import os import time from ctypes import * class USBI2C(): ch34 ...
- Proxy 代理模式 动态代理 CGLIB
代理的基本概念 几个英文单词: proxy [ˈprɒksi] n. 代理服务器:代表权:代理人,代替物:委托书: invoke [ɪnˈvəʊk] vt. 乞灵,祈求:提出或授引-以支持或证明:召鬼 ...
- 常见MIME类型
Response对象通过设置ContentType使客户端浏览器,区分不同种类的数据,并根据不同的MIME调用浏览器内不同的程序嵌入模块来处理相应的数据. MIME类型格式:类别/子类别;参数 Co ...