http 500 错误总结

500: Internal server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

应用代码出了问题,比如说空指针、数据库异常、访问其它服务的网络异常等等,被tomcat容器捕获后,返回500错误。

501: Not Implemented

The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.

502:Bad Gateway

The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.

比如nginx作为反向代理,在请求连接后端服务的时候失败了,nginx返回502,比如常见的如下场景(等等):

1.后端服务崩溃了,根本连不上,报connection refused错误等。

2.nigx去访问DNS服务起,获取uptream stream真正的地址,DNS没有配置映射。

3.后端服务的连接数满了,nginx无法与其建立新的连接。

4.后端服务架设了防火墙,导致nginx与其建立连接到时候失败。

5. 网络瘫痪,nginx无法与后端服务进行通信。

503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

出现这种问题主要有两个原因:

1.服务处于维护阶段,但不是当机。

2.举个例子,tomcat的worker已达上线,不能再处理更多的请求,会返回503。

504 Gateway Timeout

The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.

nginx设置了timeout时间,请求发送给上层服务,超过既定时间没有收到结果,nginx返回504

 

 

 

 

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值