Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of HTTP status Code

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the example analysis of HTTP status codes for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

HTTP status code

1. Status code classification

-1xx: message. The server receives the request and requires the requestor to continue the operation.

-2xx: success

-3xx: redirect

-4xx: client error

-5xx: server error

2. Common status codes

200: request succeeded

301: permanent redirection

302: temporary Mobility

400 bad request: client request syntax error

401 unauthorized: client does not have permission

403 forbidden: server rejects client request

404 not found: client request resource does not exist

500 Internal Server Eerro: server internal error

502 bad gateway: when a server working as a gateway or agent tries to execute a request, it receives an invalid response from the upstream server

503 Service Unavailable overload or system maintenance

504 Gateway timeout: gateway timeout

3. The causes of 502 and its solutions

Cause: nginx submits the request to the gateway (php-fpm) to handle the exception

1) the fastcgi buffer setting is too small

Fastcgi_buffers 8 16k

Fastcgi_buffer_size 32k

2) the number of processes set for php-cgi is too small.

Check the number of FastCgi processes: netstat-anpo | grep "php-cgi" | wc-l

Maximum number of child processes for adjusting parameters: max_children

Generally, the number of child processes that need to be set is calculated according to a single process 20m.

3) max_requests (memory overflow or frequent restart)

Parameter indicates the maximum number of requests each children can handle, and the children will be restarted when the maximum is reached.

Setting too small may cause frequent restarts of children:

Php polls requests to each children. In the case of heavy traffic, the time for each children to reach the maximum is about the same. If the setting is too small, multiple children may be shut down at the same time, and the nginx cannot forward the request to php-fpm,cpu. The load becomes higher.

Too large setting may cause memory leak

4) php execution time exceeds nginx waiting time

Fastcgi_connect_timeout

Fastcgi_send_timeout

Fastcgi_read_timeout

5) fastcgi execution time

Max_execution_time

This is the end of this article on "sample analysis of HTTP status codes". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report