HTTP Basic principle

Response header

[root@k8s-node2 ~]# curl -I
HTTP/1.1 200 OK                             --------# Response code, status code of the request 
Server: nginx/1.16.1                        --------#web Service information and software version 
Date: Tue, 04 Aug 2020 04:09:24 GMT         --------# Requested time 
Content-Type: text/html                     --------# The type of content requested 
Content-Length: 14529                       --------# Request body length 
Last-Modified: Mon, 03 Aug 2020 03:57:18 GMT   -----# The last revision date of the content 
Connection: keep-alive                      --------# The connection type is   A long connection 
ETag: "5f278b1e-38c1"                       --------#ETag It is one that can be associated with Web The token of resource association (token)tag It's useful for breakpoint downloads .
Accept-Ranges: bytes                        --------# It is used to tell the client whether the server can handle the scope request , To specify a part of the server resource .
                                            --------#  If it is  Accept-Ranges: none  It indicates that the range request processing cannot be performed 

Response status code

http agreement 1.1 In the version, the status code can be divided into 5 class 
Status code range Function description
100-199 Used to specify certain actions of the client
200-299 Used to indicate a successful request
300-399 For files that have been moved , And is often included in the positioning header information to specify new address information
400-499 Used to indicate client errors
500-599 Used to point out errors on the server side

Detailed description :

Status code Describe in detail
200 - ok The server successfully returned to the web page , It was a success http The standard status code returned by the request
301 - Jump forever Moved Permanently
302 - A temporary jump
Permanently or temporarily jump the requested page to the specified new location
Such as : from Jump to
403 - Forbidden Blocking access , Although the request is legal , But the server matches the preset rules , Rejected the client's request , This kind of problem is generally caused by improper server configuration permissions .
404 - Not Found The requested specified page cannot be found , Maybe the client requested a resource that doesn't exist on the server
500 - internal server error Internal server error , The server encountered an unexpected situation , Unable to complete client request
This is usually caused by the internal configuration error of the server , such as selinux Open the No permission http
502 - Bad Gateway Gateway error , Generally, when the proxy server requests the back end , The back end is not available , Or not responding to the server .
503 - service unavailable The server is currently unavailable , Maybe the server is overloaded or shut down for maintenance , It is also possible that there is no service node behind the proxy server
504 - gateway timeout gateway timeout , Generally, the gateway proxy server requests the back-end server , The back-end server does not return data within a specific time .

http resources

http Resources are divided into   Static resources   And dynamic resources 
 Static resources are plain text, such as  html page , file   picture   Streaming media, etc 
 Dynamic resources   Most dynamic resources need the support of database , The extension is  .asp .aspx .php .js .do .cgi etc. 
 Pseudo static resources   from URL Look at the address , Pseudo static surfaces look like static web content , Suffix with .html ending , But it's actually through rewrite Rewrite the . Good for search engines to include 

pv uv

uv :  Independent visitor , The same client is visited many times in one day , Only recorded as a uv
pv :  According to the number of visits , Every visit is a pv


 According to user information , Set an identity for the user ,( Keep it locally ), As the key to verification 


 Record user information , User information , He keeps it on the server , It's like a lock 

Concurrent connections

 The maximum number of connections that a web server can handle per unit time 

 Statistical concurrency method :
netstat -ant|grep -i "est"
netstat -an|grep -i "est"|wc -l

Statistics website of UV PV Independent IP Method

 Statistical independence IP:
cat /application/nginx/logs/access_81.log | awk '{print $1}'|sort |  uniq -c|wc -l

 Statistics pv:
grep "/index.html" /var/log/nginx/access.log –c 

 Statistics UV:
cat /application/nginx/logs/access_81.log | cut -d " " -f 1|uniq -c|wc -l