天天看點

http code 傳回碼

4xx系統

404 Not found 資源不存在 如

403 Forbiden 禁止  權限不允許或者通路的目錄沒權限或者目錄中index頁面不存在

499: 這個要關注了特别是nginx

499, client has closed connection

代表用戶端主動斷開了連接配接,一般是服務端處理時間太長了,用戶端等不了就斷開了主動斷開關閉浏覽器。還有一種情況就是有人攻擊,故意消耗服務端資源。

在nginx源碼中,499對應的定義是 “client has closed connection”。這很有可能是因為伺服器端處理的時間過長,用戶端“不耐煩”了。要解決此問題,就需要在程式上面做些優化了。

5xx系列

500

内部服務錯誤Internal Server Error

原因一般是: 通路量大,伺服器資源吃不消,或者内部執行錯誤,如後端mysql挂了。

如:memory allocation failure

502(同 504情況差不多)

Bad Gateway 

原因一般是:

1 nginx出現502有很多原因,但大部分原因可以歸結為資源數量不夠用,也就是說後端php-fpm處理有問題,nginx将正确的用戶端請求發給了後端的php-fpm程序,但是因為php-fpm程序的問題導緻不能正确解析php代碼,最終傳回給了用戶端502錯誤

2 php-fpm 挂了

503

Service Temporarily Unavailable

1 通路并發數過多

2 nginx做了并發數限制,同一個IP通路操作限制

limit_conn one 1;

504

Gateway time-out 網關逾時

原因:

1 nginx worker數目是否夠用

ps -ef |grep php-fpm |wc -l 減去2

fastcig緩沖(buffer)或者是代理的緩存情況,如果緩存過小,設定時間短,機器又繁忙,機會出現502的情況

3 php執行時間長,而設定的逾時時間又短 相關指令

fastcgi_connect_timeout 60;

fastcgi_send_timeout 60;

fastcgi_read_timeout 60;

502一般與php-fpm.conf有關,504一般和nginx的nginx.conf配置有關,都有可能是和nginx和後端有關。

【附件-code表格】

Table 13-1. HTTP response status codes

Code

Reason phrase

RFC 2616 section

No Response Received (Squid-specific)

N/A

1xx

Informational

10.1

100

Continue

10.1.1

101

Switching Protocols

10.1.2

2xx

Successful

10.2

200

OK

10.2.1

201

Created

10.2.2

202

Accepted

10.2.3

203

Non-Authoritative Information

10.2.4

204

No Content

10.2.5

205

Reset Content

10.2.6

206

Partial Content

10.2.7

3xx

Redirection

10.3

300

Multiple Choices

10.3.1

301

Moved Permanently

10.3.2

302

Found

10.3.3

303

See Other

10.3.4

304

Not Modified

10.3.5

305

Use Proxy

10.3.6

306

(Unused)

10.3.7

307

Temporary Redirect

10.3.8

4xx

Client Error

10.4

400

Bad Request

10.4.1

401

Unauthorized

10.4.2

402

Payment Required

10.4.3

403

Forbidden

10.4.4

404

Not Found

10.4.5

405

Method Not Allowed

10.4.6

406

Not Acceptable

10.4.7

407

Proxy Authentication Required

10.4.8

408

Request Timeout

10.4.9

409

Conflict

10.4.10

410

Gone

10.4.11

411

Length Required

10.4.12

412

Precondition Failed

10.4.13

413

Request Entity Too Large

10.4.14

414

Request-URI Too Long

10.4.15

415

Unsupported Media Type

10.4.16

416

Requested Range Not Satisfiable

10.4.17

417

Expectation Failed

10.4.18

5xx

Server Error

10.5

Internal Server Error

10.5.1

501

Not Implemented

10.5.2

502

Bad Gateway

10.5.3

Service Unavailable

10.5.4

Gateway Timeout

10.5.5

505

HTTP Version Not Supported

10.5.6

6xx

Proxy Error

600

Unparseable Response Headers (Squid-specific)

假如Squid從原始伺服器沒有接受到任何響應,你可在access.log裡看到狀态碼0。假如Squid接受到的響應沒有包含HTTP頭部,就會出現狀态碼600。在少數情況下,某些原始伺服器僅發送響應body,而忽略了任何頭部。

本文轉自殘劍部落格51CTO部落格,原文連結http://blog.51cto.com/cuidehua/1829225如需轉載請自行聯系原作者

cuizhiliang

繼續閱讀